Skip to content

Instantly share code, notes, and snippets.

@alexvy86
Last active July 16, 2020 03:31
Show Gist options
  • Save alexvy86/9ee0aea7b81a857b4a822da7858a95b2 to your computer and use it in GitHub Desktop.
Save alexvy86/9ee0aea7b81a857b4a822da7858a95b2 to your computer and use it in GitHub Desktop.
Stuff to move out of the C:\ drive

Stuff to move out of the C:\ drive

This is a compilation of things that by default are saved to the C:\ drive but can be easily told to move somewhere else. It can help to minimize disk usage for SSDs (which the OS disk usually is). Mostly focused on development stuff, since that's mostly what I've seen occupying space in my drives, but I'll add other things as well.

npm package cache

Set the npm_config_cache environment variable to the new path (e.g. G:\AppData\Roaming\npm-cache)

Or run npm config set cache "<new-path>" --global .

Documentation for npm cache and for npm config.

pip and pipenv cache directories

Set the PIP_CACHE_DIR and PIPENV_CACHE_DIR environment variables to their respective new paths (e.g. G:\AppData\Local\pipenv\pipenv\Cache).

Documentation for pip (not very specific) and pipenv.

Main NuGet packages folder

%userprofile%\.nuget\packages Set the NUGET_PACKAGES environment variable to the new path (e.g. D:\Users\<user>\.nuget\packages)

%localappdata%\NuGet\v3-cache Set the NUGET_HTTP_CACHE_PATH environment variable to the new path (e.g. G:\AppData\Local\NuGet\v3-cache)

%localappdata%\NuGet\plugins-cache Set the NUGET_PLUGINS_CACHE_PATH environment variable to the new path (e.g. G:\AppData\Local\NuGet\plugins-cache)

Documentation

Visual Studio package cache

Documentation.

ReSharper solution caches

Follow instructions here. Note that this moves the Solution caches, but the Shell caches stay in the standard AppData/Local folder. Luckily those are much smaller.

Cypress binary location cache

Set the CYPRESS_CACHE_FOLDER environment variable to the new path (e.g. G:\AppData\Local\Cypress\Cache).

Documentation.

Steam game library

Right click the windows tray icon, go to Settings. Go to Downloads and click "STEAM LIBRARY FOLDERS". Add the new location (e.g. G:\SteamLibrary) and make it the default (right-click -> Make default folder).

%USERPROFILE%/.ssh

Create a symbolic link from C:\Users\<username>\.ssh to D:\Users\<username>\.ssh:

mklink /D C:\Users\alexv\.ssh D:\Users\alexv\.ssh

This is convenient because Windows OpenSSH client reads its stuff from %USERPROFILE%/.ssh (the one in C:\), but I purposefully move my files to a separate drive so Windows can be reinstalled more easily. And my SSH keys and configuration files are somethig I want to keep together with my files in that scenario.

NOTE: mklink is only available on the default command line cmd, not in powershell.

%HOME% variable

Git for Windows uses a %HOME% variable to do its stuff, and by default points it to %USERPROFILE%, which means that if left to its own devices, it would put files like .gitconfig and similar to C:\Users\<username>. But since those are files I want to keep with my user data, not in C:\, I create a %HOME% environment variable for my user, that points to where I put my user folder outside of C:\, e.g. D:\Users\<username>\. This is also why I create a %HOME% variable pointing to D:\Users\<username>, so that some tools that put files there (looking at you, Git for Windows) put them in D:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment