How To Change Dropbox’s Default Directory Location?

Who does not like Dropbox? Even Google wants a share of Dropbox users and finally launched Google Drive.  Dropbox gives freedom to our files from the desktop and gives life to be everywhere, on your mobile, on your tablet,  on your desktop, and in the cloud.  In MacOS X/Linux by default Dropbox creates the “Dropbox” directory at your home directory.  For any reason, you might want to move the Dropbox directory to somewhere else after the installation.

There are at least two options to move your Dropbox directory to a new location. The easy way is using the icon for Dropbox Desktop application. And the second approach is for those who want to avoid clicks, but use command line options.

Move Dropbox Directory to New Location Using Dropbox Desktop Application

  1. Click Dropbox icon from the system tray.
  2. Choose Preferences
  3. And Select Move…
  4. Select the new location where you want to move your Dropbox directory

And this initiate the move of your content from current location to the new location. The directory will still be named as Dropbox, but will be at a new location.

Move Dropbox Directory to New Location Using Command Line

If you want to move an existing dropbox directory to a new location, say /foo/bar using command line, you first need to stop running Dropbox, back up the database and use python script from Dropbox to complete the process. Here is the step by step instructions to do it.

#Stop dropbox
~/dropbox.py stop
#Backup your Dropbox database.
cp ~/.dropbox/dropbox.db dropbox.db.backup
#Get the Python script for helping changing the directory location
wget http://dl.dropbox.com/u/119154/permalink/dropboxdir.py
#Change permission to to execute the new python script.
chmod +x dropboxdir.py
#Move your current Dropbox directory to a new location
#”/path/to/newDropbox/location”
mv ~/Dropbox /path/to/newDropbox/location
#Tell Dropbox to use the new directory location
./dropboxdir –setfolder=/path/to/newDropbox/location
#Start Dropbox.
~/dropbox start

An useful tip from Dropbox is that “Do not just create a new empty directory and setfolder to it – when you restart dropbox, it will think you’ve deleted all your files, and delete them from everywhere else too.” And the script dropboxdir.py must be located in parent directory to ~/.dropbox-dist/.