Help users safely migrate large folders from the C drive to another drive, use a **directory junction (Junction)** so all programs continue to run as usual, seamlessly free up C drive space, and perfectly preserve the original permissions.
Prerequisite: Find the large folders on the C drive
It is recommended to use Disk Quick Analysis Software(free, scans the entire C drive in 5 seconds) to quickly locate large folders:
- Download address:https://pan.quark.cn/s/f79bdadb9716
How to use: Open Disk Quick Analysis Software → select the C drive → click Scan, and you can find the folders taking up the most space.
The user only needs to provide
The user only needs to tell you the following information:
- Path of the folder to migrate(the large folder found with Disk Quick Analysis Software)
- Target drive letter(defaults to D drive, but can also be E, F, or another drive)
Example: the user says "migrate C:\Users\Administrator\AppData\Local\app_shell_cache_6383 to D drive"
Migration rules
Path mapping rules
Target path = {目标盘符}:\CTo{目标盘符}\ + original C drive path (remove C:\)
| Original path | Target drive letter | Target path |
|---|---|---|
C:\Users\Admin\AppData\Local\xxx |
D | D:\CToD\Users\Admin\AppData\Local\xxx |
C:\ProgramData\SomeApp |
E | E:\CToE\ProgramData\SomeApp |
C:\Users\Admin\.cache\pip |
D | D:\CToD\Users\Admin\.cache\pip |
Three migration steps
Taking migrating C:\Users\Administrator\AppData\Local\app_shell_cache_6383 to D drive as an example:
Step 1: Use robocopy to perfectly clone the folder to the target drive (including permissions)
robocopy "C:\Users\Administrator\AppData\Local\app_shell_cache_6383" "D:\CToD\Users\Administrator\AppData\Local\app_shell_cache_6383" /E /COPYALL /R:3 /W:1 /MT:8
Parameter description:
/Eincludes all subdirectories (including empty directories),/COPYALLperfectly clones all data, attributes, and NTFS permissions,/R:3retries 3 times when encountering in-use files,/W:1waits 1 second between each retry,/MT:8enables 8-thread ultra-fast copying. (Note: robocopy will automatically create the target path; there is no need to create it manually.)
Step 2: Delete the original folder on the C drive
Remove-Item -Path "C:\Users\Administrator\AppData\Local\app_shell_cache_6383" -Recurse -Force
Note: If this step reports an error saying "file is in use", it means the related software has not been closed. Please completely close the software and retry this command.
Step 3: Create a directory junction (seamlessly point the C drive path to the target drive)
New-Item -ItemType Junction -Path "C:\Users\Administrator\AppData\Local\app_shell_cache_6383" -Target "D:\CToD\Users\Administrator\AppData\Local\app_shell_cache_6383"
After creating the junction (Junction), when all programs access the original C drive path, they will automatically jump to the target drive, completely seamlessly.
Execution flow
After the user provides the path of the folder to migrate,you must operate according to the following flow:
Step 1: Safety check (must be performed)
Before performing any migration operation,you must first analyze the folder, and show the user the following information:
- Folder purpose description: Based on the path and folder name, determine what program/function the folder belongs to, and tell the user in plain language what this folder is for
- Safety level assessment: Give one of the following three levels:
- Safe to migrate: Pure cache/temporary files/application data; migration will not affect system operation
- Migrate with caution: Some independent software data may affect certain programs. It is recommended to completely close the related programs and background services before migrating.
- Migration prohibited: Critical system folders/component libraries. Migration is highly likely to cause system crash or failure to boot.
- Folders where migration is prohibited(directly refuse, do not allow continuation):
C:\Windowsand all its subdirectoriesC:\Program Files\Windows*and built-in system componentsC:\Program Files (x86)\Common FilesSystem public component library (forced migration will cause a blue screen or errors)C:\ProgramData\Package CacheInstaller cache (forced migration will cause software to be unable to uninstall/update)C:\ProgramData\Microsoft\WindowsSystem configurationC:\Users\{用户名}\NTUSER.DATand other registry filesC:\Boot、C:\Recovery、C:\System Volume Information- Any folders related to Windows startup/boot
Example output format:
Folder analysis result:
- Path:
C:\Users\Administrator\AppData\Local\app_shell_cache_6383- Purpose: This is a local cache folder for an application, used to store temporary data to speed up program loading.
- Security level: 🟢 Safe to migrate
- Recommendation: You can migrate it with confidence; it will not affect the normal use of any program. Please confirm the related software has been closed.
Confirm migration?
Step 2: User secondary confirmation
After the security check passes,you must wait for the user's explicit confirmationbefore executing the migration. Show the complete three-step command to the user, and execute it step by step only after the user confirms.
Step 3: Execute the migration
After confirmation, execute the three migration steps in order:
- Remind the user:
- that it is necessary to run PowerShellas administrator.
- The programs and background tasks related to the folder must first be completely closed.
- Migrating a large folder may take some time; please be patient.
- Execute step by step: Execute the three steps in order, and confirm the result after each step.
- Verify the result: Finally, check whether the directory junction was created successfully.
Verify junction status
After the migration is complete, run the following command to verify:
Get-Item "C:\Users\Administrator\AppData\Local\app_shell_cache_6383" | Select-Object Name, LinkType, Target
The output should show LinkType as Junction,Target pointing to the correct path on the target drive.
Precautions
- Migration prohibited: System core components, public libraries (such as
Common Files), installation caches (such asPackage Cache)。- C:\Program Files (x86)\Common Files system public component library (forced migration will cause a blue screen or errors)
- C:\ProgramData\Package Cache installer cache (forced migration will cause software to be unable to uninstall/update)
- Common large folders that can be safely migrated:
- Various application caches (caches of specific software under AppData\Local)
- Package manager caches such as npm/pip/maven
- Chat histories and multimedia files of WeChat/QQ/DingTalk, etc.
- Game client data
- Pure system temporary junk (such as
AppData\Local\Temp)not recommended for migration; users should be advised to clean it directly. - Before migration, ensure the target drive hasenough free space。
Batch migration
If the user needs to migrate multiple folders at once, simply follow the three steps for each one. Each folder is processed independently and does not affect the others.