Windows C Drive Cleanup
Core Rules
Prefer inspection before deletion. Treat C drive cleanup as a filesystem safety task, not a generic "delete large files" task.
- State the boundary before acting: "read-only check", "cache cleanup", or "migration with junction".
- Exclude reparse points/junctions from size calculations unless explicitly verifying them.
- Never delete or move system, driver, Office, runtime, service, or uninstall-support folders just because they are large.
- Do not directly cut-and-paste app data folders. Move data to the target drive, then create a junction at the original path.
- Record every destructive or path-changing action in a timestamped folder under the current workspace.
- If deletion fails because files are in use, leave them and report that they are live temp files.
- If permission fails and the user asked for it, open the folder with Explorer instead of escalating.
Standard Workflow
Inspect C drive usage.
- Measure the relevant roots with reparse points skipped.
- Check app install registry entries and start-menu shortcuts when the user asks why an app appears on C.
- Check running processes before touching app data.
Classify each large item.
- Delete only obvious cache/temp/log/crash/update artifacts.
- Migrate live user data that an app expects at a fixed C path.
- Keep system components, drivers, runtimes, uninstallers, services, and account/chat databases unless the user explicitly accepts the risk.
Execute narrowly.
- Close or verify absence of processes for the target app.
- Clean small disposable targets first.
- Migrate large live directories one at a time to the app's install drive or the user's chosen drive.
- Create a junction from the original C path to the new location.
Verify.
- Confirm original paths exist as
Directory, ReparsePoint.
- Confirm targets exist and sizes/file counts are plausible.
- Re-check C drive free space.
- Summarize exactly what was deleted, migrated, skipped, and why.
Useful Scripts
Use these scripts when they fit the task; read or adapt them if the exact safety policy needs adjustment.
scripts/scan_hotspots.ps1: scan top-level C drive hotspots while skipping junction contents.
scripts/migrate_to_junction.ps1: move one or more directories and create junctions at the original paths.
scripts/clear_cache_targets.ps1: clear explicitly named cache/temp directories or files, skipping reparse points and recording failures.
Run scripts from PowerShell. Example:
powershell -ExecutionPolicy Bypass -File "$HOME\.codex\skills\windows-c-drive-cleanup\scripts\scan_hotspots.ps1" -Top 50
App Pattern Reference
Read references/app-patterns.md before making app-specific decisions. It captures common patterns from prior cleanup work, including Tencent/WeChat/QQ, DingTalk, Baidu Netdisk, Tencent Meeting, CloudMusic, and small generic caches.
Decision Guidance
Delete when:
- The directory name is clearly
Cache, Code Cache, GPUCache, DawnCache, Temp, CrashDumps, Log, logs, update, or an old app temp folder.
- The app is closed.
- The path is under the specific app data root being handled.
- The target is not a reparse point.
Migrate when:
- The directory is large and belongs to active app state under
AppData\Roaming or AppData\Local.
- The app likely recreates the same C path if the directory is merely moved.
- The user wants C space back without losing app state.
Keep when:
- The path is
Program Files, Program Files (x86), ProgramData, Office, Visual C++ runtime, Edge WebView, NVIDIA, Lenovo, Autodesk, dotnet, Windows, or a service executable, unless there is a precise app-specific reason.
- The directory contains chat history, account databases, playlists, offline music, or user project data and no migration is requested.
Migration Pattern
Use a junction, not a symlink, for ordinary app data folders:
- Verify the app is closed.
- Verify the destination does not already exist.
- Measure source size and file count.
- Move source to target drive.
- Create a junction at the original source path.
- Verify
Get-Item shows Directory, ReparsePoint and the target path is correct.
Prefer destinations near the app install directory:
E:\Program Files (x86)\Tencent\UserData\Roaming\<name>
E:\Program Files (x86)\DingDing\UserData\...
E:\BaiduNetdiskDownload\BaiduNetdisk\BaiduNetdisk\UserData\...
<non-C-drive>\TencentMeeting\UserData\...
Reporting
Keep the final answer short and concrete:
- What changed.
- What was deleted versus migrated.
- How much space was freed or moved off C.
- Which paths are now junctions.
- Any files left because they were in use or permission-protected.
- The absolute path to the timestamped record directory.
1---2name: windows-c-drive-cleanup3description: Safely audit, clean, and migrate Windows C drive application data. Use when the user asks to inspect C drive usage, reduce C drive space, clean application caches, remove stale startup/menu/app remnants, move AppData or Roaming/Local folders to another drive with junctions, or troubleshoot why apps installed on D/E/F still occupy C drive.4---56# Windows C Drive Cleanup78## Core Rules910Prefer inspection before deletion. Treat C drive cleanup as a filesystem safety task, not a generic "delete large files" task.1112- State the boundary before acting: "read-only check", "cache cleanup", or "migration with junction".13- Exclude reparse points/junctions from size calculations unless explicitly verifying them.14- Never delete or move system, driver, Office, runtime, service, or uninstall-support folders just because they are large.15- Do not directly cut-and-paste app data folders. Move data to the target drive, then create a junction at the original path.16- Record every destructive or path-changing action in a timestamped folder under the current workspace.17- If deletion fails because files are in use, leave them and report that they are live temp files.18- If permission fails and the user asked for it, open the folder with Explorer instead of escalating.1920## Standard Workflow21221. Inspect C drive usage.23 - Measure the relevant roots with reparse points skipped.24 - Check app install registry entries and start-menu shortcuts when the user asks why an app appears on C.25 - Check running processes before touching app data.26272. Classify each large item.28 - **Delete** only obvious cache/temp/log/crash/update artifacts.29 - **Migrate** live user data that an app expects at a fixed C path.30 - **Keep** system components, drivers, runtimes, uninstallers, services, and account/chat databases unless the user explicitly accepts the risk.31323. Execute narrowly.33 - Close or verify absence of processes for the target app.34 - Clean small disposable targets first.35 - Migrate large live directories one at a time to the app's install drive or the user's chosen drive.36 - Create a junction from the original C path to the new location.37384. Verify.39 - Confirm original paths exist as `Directory, ReparsePoint`.40 - Confirm targets exist and sizes/file counts are plausible.41 - Re-check C drive free space.42 - Summarize exactly what was deleted, migrated, skipped, and why.4344## Useful Scripts4546Use these scripts when they fit the task; read or adapt them if the exact safety policy needs adjustment.4748- `scripts/scan_hotspots.ps1`: scan top-level C drive hotspots while skipping junction contents.49- `scripts/migrate_to_junction.ps1`: move one or more directories and create junctions at the original paths.50- `scripts/clear_cache_targets.ps1`: clear explicitly named cache/temp directories or files, skipping reparse points and recording failures.5152Run scripts from PowerShell. Example:5354```powershell55powershell -ExecutionPolicy Bypass -File "$HOME\.codex\skills\windows-c-drive-cleanup\scripts\scan_hotspots.ps1" -Top 5056```5758## App Pattern Reference5960Read `references/app-patterns.md` before making app-specific decisions. It captures common patterns from prior cleanup work, including Tencent/WeChat/QQ, DingTalk, Baidu Netdisk, Tencent Meeting, CloudMusic, and small generic caches.6162## Decision Guidance6364Delete when:6566- The directory name is clearly `Cache`, `Code Cache`, `GPUCache`, `DawnCache`, `Temp`, `CrashDumps`, `Log`, `logs`, `update`, or an old app temp folder.67- The app is closed.68- The path is under the specific app data root being handled.69- The target is not a reparse point.7071Migrate when:7273- The directory is large and belongs to active app state under `AppData\Roaming` or `AppData\Local`.74- The app likely recreates the same C path if the directory is merely moved.75- The user wants C space back without losing app state.7677Keep when:7879- The path is `Program Files`, `Program Files (x86)`, `ProgramData`, Office, Visual C++ runtime, Edge WebView, NVIDIA, Lenovo, Autodesk, dotnet, Windows, or a service executable, unless there is a precise app-specific reason.80- The directory contains chat history, account databases, playlists, offline music, or user project data and no migration is requested.8182## Migration Pattern8384Use a junction, not a symlink, for ordinary app data folders:85861. Verify the app is closed.872. Verify the destination does not already exist.883. Measure source size and file count.894. Move source to target drive.905. Create a junction at the original source path.916. Verify `Get-Item` shows `Directory, ReparsePoint` and the target path is correct.9293Prefer destinations near the app install directory:9495- `E:\Program Files (x86)\Tencent\UserData\Roaming\<name>`96- `E:\Program Files (x86)\DingDing\UserData\...`97- `E:\BaiduNetdiskDownload\BaiduNetdisk\BaiduNetdisk\UserData\...`98- `<non-C-drive>\TencentMeeting\UserData\...`99100## Reporting101102Keep the final answer short and concrete:103104- What changed.105- What was deleted versus migrated.106- How much space was freed or moved off C.107- Which paths are now junctions.108- Any files left because they were in use or permission-protected.109- The absolute path to the timestamped record directory.