Documentation

Disk cleanup

Disk cleanup answers two questions in one tab: what takes space on this disk, and what of it can go. You see the disk split into Windows, programs, users and what can be freed, then categories with their sizes. Every category says what it is, whether it is safe to delete and how it is deleted. Nothing personal is ever selected in advance, and nothing is deleted before you confirm a list with sizes.

The Disk cleanup tab: a bar splitting the disk into Windows, programs, users, can be freed and free space, and categories with sizes and Safe, Check and Info labels

Open it

  • Right-click a disk (in the sidebar or This PC) and choose Clean up disk…, or use the Clean up disk… button in the header of the disk map.
  • Tools menu > Clean up disk…
  • In the command palette (Ctrl+Shift+P): "Clean up disk…".
  • From a script: mo --cmd "tools.disk-cleanup=D:" (see Automation and scripting).

There is no default shortcut; you can assign one in Settings > Shortcuts. Cleanup works on local disks only.

The overview

The tab opens at once. Sizes first appear from the disk service (see Settings), marked as an estimate, and are then counted exactly in the background. F5 measures again. Categories are in groups:

GroupWhat it holds
Safe to freetemporary data that programs create again
System (administrator)items that Windows or MagnumOpus delete with administrator rights - shown only when you turn them on, see below
Check yourselfyour files and projects - nothing is selected in advance
Information onlythings that cannot be deleted, only made smaller or configured

Select safe ticks the safe categories. Clean up selected… (or Del) opens the confirmation.

What it cleans up

Safe to free

CategoryWhat goesHow
Temporary files%TEMP% - files older than a day that nobody has open, and the folders they leave emptypermanently
MagnumOpus cachethumbnails, previews, folder sizes (the same items as Settings > Storage)permanently; the part in use goes at the next start
Browser cachescache only - Chrome, Edge, Brave, Vivaldi, Chromium, Opera and Firefox. Profiles, passwords, history and cookies stay. The cache of a running browser is left out.permanently
Shader cacheDirectX, NVIDIA, AMD, Intel - games start a little slower the first timepermanently, files of a running game are skipped
Crash dumps and error reportsCrashDumps and Windows Error Reporting of this userpermanently
Windows thumbnailsthe thumbnail cache of File Explorerby Windows (the same handler as Disk Cleanup), no UAC
Recycle Binthe Recycle Bin of this disk, with its contents and deletion dates in the detailpermanently - never selected in advance

Check yourself

CategoryWhat it showsHow
Old downloadsitems in Downloads that you have not opened for 90 daysdetail: tick items, Move to Recycle Bin…
Large filesfiles from 1 GB outside Windows and Program Files - Find… goes through the disk in the backgrounddetail, to the Recycle Bin
Duplicatesthe same files in more placesFind duplicates… opens Find duplicates
Developer tool cachesnpm, pip, Cargo, Gradle, NuGet, Yarn, Go - downloaded again when neededpermanently, item by item
Build output and dependenciestarget, node_modules, .venv, bin / obj of your projectspermanently, project by project

Old downloads and large files go to the Recycle Bin with Undo (Ctrl+Z); the space is freed after you empty it. Show in list opens them as a results tab with preview, so you can look before you decide.

Developer caches and project output are cleaned up item by item in the detail, nothing selected in advance. Projects are searched for in your profile, in the usual places (such as source\repos and Projects, and repositories from recent folders) and in folders you add yourself - Add folder… in the detail or Settings > Tools > Folders with projects (disk cleanup). The detail shows when each project last changed, so you can pick the ones you have not touched for a long time.

System items

Off by default. Turn them on in Settings > Tools > System items in disk cleanup; until then neither the tab nor mo cleanup shows or runs them. They are never selected in advance, and the whole cleanup needs a single UAC prompt.

CategoryHow
Windows Update Cleanupby Windows itself, the same handler as Disk Cleanup. Installed updates can no longer be uninstalled. It can take tens of minutes.
Delivery Optimizationby Windows itself
Windows temporary filesby MagnumOpus with administrator rights: Windows\Temp older than a week, memory dumps and system error reports
Previous Windows installationby Windows itself. Irreversible: you can no longer go back to the previous version.

The confirmation has a Create a restore point before cleaning checkbox (remembered, off by default). If the restore point cannot be created, the whole cleanup stops and nothing is deleted.

Information only

  • Hibernation file (hiberfil.sys): the detail has Reduce hibernation… (fast startup stays, hibernation stops working) and Turn off hibernation… (both go, the computer starts slower). Each explains its effect and runs a fixed powercfg command after one UAC prompt. Both can be undone. Needs the system items switch.
  • Page file: Windows manages it; the button opens Performance Options.
  • Restore points and shadow copies: the button opens System Protection, where you can limit the space they take.

Confirmation, progress and result

Clean up selected… shows every category with its size. Temporary data is marked as permanent and cannot be undone; open files are skipped. Clean up {size} starts the cleanup. The tab shows progress with Stop, and then the result: how much was freed, the free space before and after, and what was skipped - open or read-only files, a running browser, parts that need an administrator, or the part that is deleted at the next start.

What it never does

Deleting is the part to get right, so the rules are strict.

  • It deletes only what the category itself counts. The list of targets is computed again at deletion time; a path outside the category, its parent or a subfolder of a target is rejected and nothing is deleted.
  • Links are not followed. A junction or symbolic link inside a target is never entered; at most an old link itself is removed, never what it points to.
  • Open files are skipped. MagnumOpus never ends a process. Read-only files are skipped and their attribute is not changed.
  • Age is checked again. A file that changed since it was measured stays.
  • Only clearly temporary data is deleted permanently. Your own files (old downloads, large files) always go to the Recycle Bin with Undo. The Recycle Bin is emptied only on request.
  • Tool caches need the tool's own marker. A folder is cleaned only when it looks like that tool's cache, and not when a link points to it. Build output is deleted only next to its project file (Cargo.toml, a dependency lock, a Python dependency list, .csproj) and not in OneDrive.
  • The administrator part is narrow. The elevated process takes only the disk and a fixed list of categories, never paths or commands, and works out what to delete by itself. It starts only after you confirm.
  • No registry cleaning and no "optimization". Browser history, cookies and profiles are not touched.

From the command line

mo cleanup prints the same overview for scripts and deletes nothing unless you ask.

mo cleanup                      overview for the drive of the current folder
mo cleanup D: --json            the same as JSON
mo cleanup C: --list browser    items of one category
mo cleanup C: --run temp,browser --yes

--run takes only the safe categories that need no rights: temp, thumbs, mo, browser, shader and dumps. Without --yes it asks first. The Recycle Bin, personal files, developer caches, projects and system items are cleaned up only in the tab. Exit code 0 means done (skipped open files are in --json), 1 a category failed or you declined, 2 an invalid switch, drive or category, 3 mo-explorer.exe is missing next to mo.exe. See the command line reference.

To see why a disk is full before cleaning it, open the disk map; to remove programs you do not use, see Apps manager.

Something wrong or missing? Open an issue