Mac: Use dropbox to sync documents and desktop folders September 23, 2016Posted by Steven in Apps.
Tags: OS X, software, Tipps
With regards to yesterday’s post briefly touching on symlinks used to backup an iPhone to an external harddrive – I would like to provide another exciting use case for handy symbilic links on a Mac.
This article caught my eye:
I really like dropbox. For me it is a quick and reliable way to synchronize files between a Mac a PC and a smartphone. The general way how dropbox works on computers:
- you download an app from dropbox.com
- it sets up a folder “dropbox” and keeps the contents of this folder in sync with other machines and with the cloud side of dropbox
For more fancy use cases it would be nice if you could pick several important folders outside of the dropbox folder to keep these files backed up or in sync as well.
Well using symbolic links you can do that! As the article neatly describes: The basic way is: create a symbolic link for example for your desktop or documents folder. Then rename the original folder and go on syncing. However if more than one Mac should sync the documents folder for example it is important that in the first round of “Rippling the change across computers” one must manually take care of the different files from different Macs all ending up in one dropbox. The article describes all the details.
A simple symlinc command would be:
sudo rm -rf ~/Documents
ln -s ~/Dropbox/Documents ~/Documents
eventually the second command has to be “sudo”ed as well:
sudo ln -s ~/Dropbox/Documents ~/Documents
And please read the article:
Update 1 / September:
- I’ve just tried the above method in order to sync the “Desktop” and “Documents” folder of a MacBook Pro Retina March 2015 model and a late 2013 iMac. The MacBook running OS X El Capitan (10.11) and the iMac running Yosemite (10.10)
- The effort ultimately succeeded but I must admit it was a little more difficult than I originally expected
- Here is what I have done in detail
- First we had to set up an approriate dropbox account – we had to log into dropbox using the browser and then download dropbox for Mac
- We ran the installer and confirmed the login in the dropbox software
- After that I opened “Terminal” and typed in the commands – starting with the linking for the “Documents” folder
- So I ran the rm then had to type the admin password then ran the ln (also I repeated with sudo ln)
- Visually in the finder I tried to inspect the results of these commands
- I opened a new Finder window and jumped to the user’s folder. Then there was a Documents folder. But it was blue’ish with the icon (so it looked unchanged from a vanilla OS X installation) when I opened the documents folder I saw just one Link there which pointed to the correct folder in the Dropbox.
- So that was not what I wanted: It looked like the standard “Documents” folder (which the rm command tried to remove) was still there and there was a link inside of it. Strange because ln …. with the target “~/Documents” should have created something in ~/ not below Documents
- On the 10.11 MacBook it seemed to help if I did the following
- make sure you are in the user’s main user directory (that is usually the case when you open Terminal). Otherwise you can check using ls and cd commands
- Then I repeated the commands but given I was already in the main user direcctory I modified them slightly:
- sudo rm -rf Documents
sudo ln -s ~/Dropbox/Documents Documents
- That seemed to work (I checked after the first command and for the first time the documents folder on the mac really was completely gone)
- I can’t fully describe it but the 10.10 iMac seemed to behave slightly different.
- I tried to run the ‘slightly modified’ commands straight away in the iMac
- But initially it would not work (I saw a documents link in the documents folder again)
- Then I used the original commands and then the new commands and it worked
- hard to explain / maybe it was just a visual glitch (I checked too quickly in finder etc.) but my impression was, that I had to run the commands multiple times and then it would work
- Closing remarks: Phew in the end it worked and that was good! (I read somewhere, that you could approach a syncing effort from the dropbox side: Go to your dropbox folder and place links to your Desktop inside your Dropbox) – this worked briefly but it’s more a backup solution. For keeping two Macs in sync this method is not so practical.
So in the end I had a user on two Macs and the default Documents and Desktop folders were removed and replaced with symlinks to Dropbox-counterparts. The dropbox software was running and keept things really nicely up to date on both machines! I will keep a close eye on this and I hope it will enable a smooth and safe workflow for the user.