MK

Auto sync your Mac Desktop folder with DropBox

UPDATE: There have been some issues reported with this method after updating to Catalina. Recommendation is now to use iCloud backup designed for Desktop and Documents folders.

DropBox is a life saver. I can stash an extra copy of pictures, documents, and archival data in the cloud, and restore the files quickly if my laptop hard drive goes bust.

The thing is, most programs (on Mac or PC) have a default storage directory that is outside of DropBox. For instance, the default location for all documents created with Microsoft Word is the Documents folder. Now, I understand it’s possible to change the default save location for most programs, but that’s a lot of work. Instead, wouldn’t it be nice to simply drag your Desktop, Photos, Movies, or Documents folders into your DropBox to keep them updated automatically?

On a PC it’s easy, on a Mac it’s inception

On a PC, that’s pretty easy. You can easily change the location of your default folders. On a Mac however, it’s not possible easy to simply change the location of one content folder within your home directory, and the DropBox folder’s default location is inside the home directory (home directory inception anyone?).

Three simple steps for keeping your home folders backed up in DropBox

Trust me on this, there’s an easy way to keep your Mac Desktop, Documents, or any other folder in your home directory backed up in DropBox automatically… and it only takes three simple steps (and a couple terminal commands). I’ll show you how to backup your Desktop folder with DropBox in this example…

Create a desktop folder within your DropBox

If you don’t know how to create a folder, you might want to start here.

Screen Shot 2015-10-01 at 8.47.49 AM

Backup your old default Desktop folder

If you have files in your existing Desktop folder, don’t worry. We’re going to back up your existing folder so you can copy your old Desktop files to your new DropBox Desktop folder afterwards.

Simply open a terminal and enter the following command.

sudo mv desktop desktop.bak

Create a symbolic link to your new DropBox Desktop folder

If you’d like to read up on symbolic links, you can do so here. The long and short is that we’re telling OSX to create a link to the Desktop folder in your DropBox, but to treat the link as if it were the default Desktop folder itself. In this way, when you save things to your Mac Desktop, they’ll appear on your Desktop as before, but actually be stored in your new DropBox folder. Here’s how to do it…

ln -s /Users/mendel/Dropbox/Desktop/ ./Desktop

And, as they say… that’s all folks! If you give this little trick a try, let me know how it went. 🙂

5 Responses

  1. Hi there
    It worked for a good moment, but now it seems, that Dropbox can’t upload the files on the desktop or gets stuck with permissions (0kb/upload). It’s because in order to keep the desktop I need to lock desktop.bak

    Does it still work for you on Catalina? Or did you switch to another method?

  2. Currently running Catalina (10.15.4) and this works like a charm – I use it to sync my desktop with OneDrive. The only slight issue is that every so often it will reset and break the symbolic link. To fix this, I created a .command file so it’s an easy double-click to switch it back. All I did was create a text file containing the two lines:
    sudo mv desktop desktop.bak
    ln -s /Users/username/OneDrive/Desktop/ ./Desktop
    Save that with the .command file extension and you’ll create a file you can double-click to run the script (like a Windows batch file). If you get an error saying you don’t have permissions to run the file just run the following in Terminal and it will then work:
    chmod u+x /path/to/file.command
    Huge thanks to this page and https://stackoverflow.com/questions/589905/equivalent-of-double-clickable-sh-and-bat-on-mac for the info!

Leave a Reply

Your email address will not be published. Required fields are marked *