With how mobile we are today with our computers–a work computer, a home computer, laptops, etc.–I found that there are common settings I want to sync across platforms. Here’s how to do it with a bit of PowerShell and a cloud storage provider.
With a laptop, work computer, and home computer, I find setting up and syncing configurations takes quite a bit of time even after initial setup.
- dot files for git and other console applications
- PowerShell configurations
Still breathing? Great. You’re probably familiar with symbolic links in *nix platforms, but they’re alive and well in Windows as well (and even sexier with a few PowerShell shortcuts). Let’s set this up–it’s not scary.
To get this party started, you’ll need some sort of cloud file repository. Dropbox and Google Drive work well for this. I’m assuming you could use Skydrive as well if you’re on Windows 8, but I haven’t done much testing with Skydrive. I find Dropbox more friendly to use for binary file syncing (since I use GoogleDocs heavily for file editing and mass numbers of files can get confusing in their web-based UI).
Once you have that settled and a directory on your local computer setup, you’re ready to start linking!
Using PowerShell Symbolic Link Helpers
To start off, let’s add a few helper methods to the mix. You can use good old mklink, but I like a good wrapper so I don’t have to tinker with syntax.
jpoehls has a fantastic set of symlink wrappers in this gist.
New-Symlink %DESTINATION% %SOURCE%
New-Symlink $HOME.gitconfig d:dropboxdotfiles.gitconfig
Easy. You only need to setup the symbolic link once.
Now, using this syntax, you can link your various dot files, configuration settings, and other disparate files from Dropbox or other file sharing solutions to the exact locations they need to be. Now your individual files will stay in sync as you go from computer to computer–without any worry or hassle!
Here are a few examples of files that I’m using symbolic links for:
- Google Docs settings
- KDiff settings
- .vimrc, .gitconfig, all the general dot files.
- hosts files