AI Agent Hub
Back to skills
🔒

Safe C: Drive Cleanup

IT Ops & Security Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_c1ee5550/safe-c-drive-cleanup.

About this skill

Problem

When Windows C: drive runs low on space, manual deletion can damage pagefile.sys, WinSxS, System32, or user data. This skill separates cleanup into read-only scanning, scope confirmation, and recoverable removal to reduce accidental deletion.

Workflow

  • Scan: uses Python os.walk to generate a Markdown report, bucketing top-level and second-level directory sizes, listing files of 100 MB or larger, and skipping symlinks to avoid runaway traversal.
  • Confirm: proposes safe candidates such as Temp, updater caches, Windows.edb, and old backups, while explicitly excluding core system paths and user data; requires explicit multi-select confirmation before removal.
  • Execute: calls SHFileOperationW with FOF_ALLOWUNDO to send selected files to the Recycle Bin instead of permanent deletion; processes paths in small batches and skips locked files with reporting.
  • Special cases: if Windows.edb is locked by Windows Search, it can stop WSearch, recycle the file, then restart and verify the service; pagefile.sys is never touched.

Boundaries and Notes

The skill relies on a specific command form to work around sandbox restrictions on protected paths, requiring Windows paths in single quotes with literal backslashes. It only moves files to the Recycle Bin; actual space is reclaimed only after the user explicitly confirms emptying it.

Use Cases

  • C: drive is low on space; generate a read-only report before confirming cleanup targets.
  • Remove Temp, updater caches, and old backups to the Recycle Bin without permanent deletion.
  • Handle locked Windows.edb by checking Windows Search status before safe cleanup.
  • Avoid touching pagefile.sys, WinSxS, System32, or user data during C: cleanup.

Best For

  • IT engineers maintaining Windows test machines need to free C: space while keeping files recoverable.
  • Developers running local toolchains need to clear caches and old backups without losing config.
  • Ops engineers taking over Windows hosts need read-only scanning and per-item confirmation.
  • Windows developers need to handle locked Windows.edb and temp files safely.