Thursday, February 8, 2018

Storing Mac primary data storage folders within cloud storage folders

One of my favorite methods of backup is redirecting the primary data storage folders to a cloud service (like Dropbox or Google Drive).  On a Mac, the process is not intuitive.  Here's my process.

You need to perform the steps once for each folder you want to move.  So if you want to move three folders (desktop, documents, pictures), you'll need to perform the steps three times.  The steps involved two commends.

First, you move the data to the new location.  Then you create a symbolic link to the new location.  In the examples below are a series of commands for desktop, documents, pictures, music, and movies.  The commands with %username% and %Company% would be altered to match the real world situation.

iMac:~ username$ sudo mv ~/Documents "/Users/%username%/Dropbox (%Company%)/laptopdata/Documents"
iMac:~ username$ sudo rm -rf ~/Documents/
iMac:~ username$ ln -s "/Users/%username%/Dropbox (%Company%)/laptopdata/Documents" ~
iMac:~ username$ sudo mv ~/Desktop "/Users/%username%/Dropbox (%Company%)/laptopdata/Desktop"
iMac:~ username$ sudo rm -rf ~/Desktop/
iMac:~ username$ ln -s "/Users/%username%/Dropbox (%Company%)/laptopdata/Desktop" ~
iMac:~ username$ sudo mv ~/Movies "/Users/%username%/Dropbox (%Company%)/laptopdata/Movies"
iMac:~ username$ sudo rm -rf ~/Movies/
iMac:~ username$ ln -s "/Users/%username%/Dropbox (%Company%)/laptopdata/Movies" ~
iMac:~ username$ sudo mv ~/Pictures "/Users/%username%/Dropbox (%Company%)/laptopdata/Pictures"
iMac:~ username$ sudo rm -rf ~/Pictures/
iMac:~ username$ ln -s "/Users/%username%/Dropbox (%Company%)/laptopdata/Pictures" ~
iMac:~ username$ sudo mv ~/Music "/Users/%username%/Dropbox (%Company%)/laptopdata/Music"
iMac:~ username$ sudo rm -rf ~/Music/
iMac:~ username$ ln -s "/Users/%username%/Dropbox (%Company%)/laptopdata/Music" ~