Skip to content

SystemCleaner

Matthias Urhahn edited this page Mar 11, 2020 · 8 revisions

SystemCleaner

The SystemCleaner is a file/directory based filtering engine. It full fills a task similar to the AppCleaner tool, but it has no notion of "apps". It searches the whole device and tries to sort found items into different filter based on each items metadata. The default SystemCleaner filter target expendable files that can't be attributed to a specific app.

Filter

A filter specifies a set of rules that a file has to meet before it is sorted into it. SD Maid provides a set of default filters that you can choose from, but you can also import userfilters or create your own filter.

Each filter has a color icon ranging from green to red. The color gives a rough indication on how important files in that filter may be or how dangerous it would be if SD Maid would make a mistake. It's part of SD Maids motto to provide you with honest information.

Example: A filter for files from crashed applications may be green because these files are expendable and are created after the app has crashed, which means that it is unlikely to affect a running app. A filter targeting temporary files is likely red, because these are ofte created and used by running apps. Deleting it could lead to an app crashing or not yet saved data being lost.

Empty directories

You may notice that the empty directories filter still shows items despite already running it previously. The reason behind that is that the SystemCleaner only works based on the information an individual file or directory provides. This means that a directory "A" is not empty if contains a directory "B", even if directory "B" is empty. So in constellations such as A/B/C where A only contains B, and B only contains C, you need to do 3 iterations until A is deleted due to be an empty directory.

'/data/system/dropbox'

This folder contains crashtracking related files that are created by the system. It has no relation to the cloudstorage app Dropbox. More info.

UserFilter

You can create your own filter (i.e. a "UserFilter") to target specific files for which SD Maid does offer a default filter.

For simple filters you can use the Explorer action create filter.

To manually create a filter open the filter manager, switch to the "User" tab and use the "+" icon. Try to make the filter as specific as possible and make sure to check what has been sorted into it after a scan before you start deleting.

Note that a file on primary public storage (e.g. internal sdcard) may be reached through multiple pathes. In the following example all pathes may lead to the same file:

  • /sdcard/Strawberry.pdf
  • /storage/emulated/0/Strawberry.pdf
  • /mnt/sdcard/Strawberry.pdf
  • /data/media/0/Strawberry.pdf (if you are rooted)

SD Maid will not find the file under all of the pathes though. This means that if you create a filter using complete pathes check which path you are using before pulling your hair because a filter is not working. It is recommended to use the path listed in SD Maids Overview which is the official path the Android system provides.

Criteria

Below criteria are ordered by evaluation order. The order also reflects how costly they are to evaluate as we want to abort as early as possible to keep good filtering performance.

Label

The head line used for the entry.

  • JSON value label

Description

The entries description.

  • JSON value description

Identifier

A unique identifier for the filter within SD Maid. If you create this filter from within SD Maid it will automatically be generated for you.

  • JSON value identifier (Valid values: Needs to end with ".scuf.sdm" (system cleaner user filter sd maid).)

Color

A hex color code for the filter. Can currently only be changed by editing the filter file.

  • JSON value color (Valid values: #??????)

Root only

Whether SD Maid should show the filter if root is not available. Can currently only be changed by editing the filter file.

  • JSON value rootOnly (Valid values: true,false)

Target type

If the target should be a file or directory.

  • JSON value targetType (Valid values: FILE,DIRECTORY)

Maximum size

The maximum size the target is allowed to be in bytes.

  • JSON value maximumSize

Minimum size

The minimum size the target has to be in bytes.

  • JSON value minimumSize

Maximum age

The maximum age the target can be in miliseconds.

  • A valid match fulfils NOW - lastModification =< maximumAge
  • JSON value minimumAge

Minimum age

The minimum age the target has to be in miliseconds.

  • A valid match fulfils NOW - lastModification >= minimumAge
  • JSON value minimumAge

Base path

A targets path has to start with one of these entries.

  • JSON array mainPath

Path contains

The targets path has to contain one of these strings

  • JSON array pathContains

Name starts with

The targets name has to start with one of these entries.

  • JSON array possibleNameInits

Name ends with

The targets name has to end with one of these entries.

  • JSON array possibleNameEndings

Exclusions

The targets path should not contain any of these entries.

  • JSON array exclusions

Regular expression

A regular expression that will be applied to the whole path and has to match.

  • JSON array regexes

Location

If the target should be in a specific location on your device.

  • JSON array locations

Valid values:

  • SDCARD, public primary and secondary storage
  • PUBLIC_MEDIA, Android/media on public primary and secondary storage
  • PUBLIC_DATA, Android/data on public primary and secondary storage
  • PUBLIC_OBB, Android/obb on public primary and secondary storage
  • PRIVATE_DATA, /data/user/0
  • APP_LIB, /data/app-lib
  • APP_ASEC, /data/app-asec
  • APP_APP, /data/app
  • APP_APP_PRIVATE, /data/app-private
  • DALVIK_DEX, /data/dalvik-cache/arm
  • DALVIK_PROFILE, /data/dalvik-cache/profile
  • DOWNLOAD_CACHE, /cache
  • DATA, /data
  • PORTABLE, USB devices

Export

A user filter can be be exported as well as imported. The export format for such filter is a .json which can also be edited manually with a text editor. This is a sample file showing most attributes:

{
    "version": 4,
    "label": "Downloaded PDFs",
    "description": "Delete all downloaded PDF files.",
    "identifier": "0ef6d43f4d46.scuf.sdm",
    "color": "#03a9f4",
    "rootOnly": false,
    "targetType": "FILE",
    "locations": [
        "SDCARD"
    ],
    "mainPath": [
        "\/storage\/emulated\/0\/Download\/"
    ],
    "pathContains": [
        "files\/cache"
    ],
    "possibleNameInits": [
        "January"
    ],
    "possibleNameEndings": [
        ".pdf"
    ],
    "exclusions": [
        "important"
    ],
    "maximumSize": 1000000,
    "minimumSize": 100,
    "maximumAge": 86400000,
    "minimumAge": 3600000,
    "regexes": [
        ".+?January.+?.pdf"
    ]
}

Settings

The system cleaner has no extra settings as of v4.4.1.