Moving AppData on Windows 10
tl;dr
Move AppData
soon after installing Windows 10 on a small SSD.
This year I moved to using a solid-state drive (SSD) for my C:
drive on Windows 10. The performance is great. For the most part, my computer is fast and responsive and just runs like it's supposed to. I am using a 256GB SSD, though. And Windows is a disk hog, and all of its apps are disk hogs, and bitcoin and ethereum and other blockchains are disk hogs, so free space runs low on C:
quite often.
To remedy this, I've begun installing new apps into A:\Apps
on the >1TB magnetic drive I had originally called A:
for Archives. This helps to some degree. But most apps these days use a hidden directory in your home folder called AppData
to store user data. Sometimes the amount of that data can be copious amounts, e.g. ethereum or bitcoin especially with transaction indexing enabled, or npm.
I needed to find a way to move AppData
to the A:
drive. After a little research, I found that it's not that difficult to have AppData/Roaming
moved. While the procedure is easy to follow, there were headaches, of course. After using npm for several months, I had many packages installed globally. Many packages are dependent upon other packages and npm uses subfolders to store dependent packages. This resulted in some packages that were nested so deeply in the filesystem that Windows Explorer refused to move (or even delete!) files that had a filename (including path) that was too long. Of course, Windows 10 having a temper like the 2+ year old publicly forced beta it is, didn't give me any indication of why or how to fix it. Long story short, I had to tediously go through each folder, deleting each one & restoring it, except the ones with paths that were so long they couldn't be moved to the recycle bin. These could only be deleted permanently. Once those troublesome folders were removed, the simple procedure for moving AppData/Roaming worked.
A better way to do this, I found near the end, was to leverage the power of GNU utilities available through git for Windows. (Cygwin could have also been used, but git for windows provides a much easier install & lighter weight environment.) If you know GNU/Linux at all, you have got to install this. If you are a software developer or windows power user, you have got to install this and learn the power of these tools. It turned out there was a simple command line I could run that would print out all the files with paths that were too long to move. Again it took a little research, and leverage of my ~20 years of linux experience, to come up with this: cd ~ && find AppData/Roaming | sed -n "/\\(.\\)\\{255\\}/p"
. The output of this was the few files left in my AppData/Roaming folder that were too long to move, and they could be easily found and deleted.
So, now several gigs have been freed on my C:
drive. But now, when I run them, apps still think they're supposed to use the old AppData
folder on C:
. UGH! All my apps have to be reinstalled.
Public service message: please learn from my struggle & do this right the first time. If you need your AppData to be moved somewhere other than the default, do it as early as possible to avoid as much headache as possible.
Good luck.
thanks for the heads up... I'm almost ready to upgrade, really good to know
Cool, glad if I could help.