SystemCleaner

Matthias Urhahn edited this page Nov 25, 2016 · 2 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.

UserFilter

You can create your own filter (i.e. a "UserFilter") to target specific files for which SD Maid does offer a default filter. To 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

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)

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

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

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

Regular expression

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

  • JSON array regexes

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,
    "regexes": [
        ".+?January.+?.pdf"
    ]
}

Settings

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