C: drive became full, and it came to my mind that it’s hard to move files to a new SSD1 if I buy a new one.
So, it got me into thinking what are the things I can do to remove and free up space in my
I don’t know where I’m going from here, but I promise it won’t be boring.
— David Bowie.
The first thing that comes up is using the tool
Disk Cleanup bundled with Windows 10. It only freed up 10Gb of data, then I checked all the folder sizes which contain the largest amount of data.
The result was my user account and the
Here are the things I did in order to move
ProgramData contents to my other spare drive.
DISCLAIMER: Before doing this on your machine please test and research first each command before executing on your machine / production environment.
First, I copied and mirrored the
ProgramData folder structure and ACL’s2 using the command
/MIR flag tells
robocopy to retain security settings and state of file.
robocopy /XJ /MIR "C:\ProgramData" "D:\ProgramData"
You could also use this other command flags, this command is non-destructive unlike the mirror flag. The mirror flag deletes the file at destination while this just overwrites and retains if missing in source.
robocopy /xj /s /copyall C:\ProgramData D:\ProgramData
After everything’s done copying, you start creating junction links and symlinks3 from your spare drive (for me its the
D: drive). The
%~NA tells the batch command it will only get the base folder name, and the
%~A gets the whole absolute path. The command below will only create directory junctions to begin with:
FOR /D %A IN ("D:\ProgramData\*") DO (MKLINK /J "C:\ProgramData\%~NA" "%~A")
This next command, specifically create symbolic links to file from source to destination.
FOR %A IN ("D:\ProgramData\*") DO (MKLINK "C:\ProgramData\%~NXA" "%~A")
Then after that restart your machine and ensure everything’s working fine. I think some folders like
Packages should be excluded in copying and making junctions.
That’s all guys. If you have any questions, DM me or comment in this post.
- A solid-state drive (SSD) is a solid-state storage device that uses integrated circuit assemblies to store data persistently, typically using flash memory, and functioning as secondary storage in the hierarchy of computer storage. It is also sometimes called a solid-state device or a solid-state disk, even though SSDs lack the physical spinning disks and movable read–write heads used in hard disk drives (HDDs) and floppy disks. ↩︎
- An access-control list (ACL) is a list of permissions associated with a system resource (object). An ACL specifies which users or system processes are granted access to objects, as well as what operations are allowed on given objects. ↩︎
- A symbolic link (also symlink or soft link) is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution. ↩︎