Using Dropbox To Host or Backup Websites and Database Folders on Windows

Posted: 2016-02-15 02:23:52

There are two options to host and/or backup your local development environment’s (such as WAMP) Websites and Database folders with Dropbox.

Keeping Folders Outside Dropbox Folder

Create NTFS “Junction Points” (folder links) between sub-folders in your Dropbox folder, and WAMP’s \Websites and \Database folders…

mklink /j C:\path-to\Dropbox\Websites C:\WampDeveloper\Websites
mklink /j C:\path-to\Dropbox\Database C:\WampDeveloper\Database

Note that according to DropBox, this type of set up will only sync when the DropBox service or the computer is restarted (i.e., changes before a restart will not be backed-up)…

Dropbox will follow Windows junction points (Windows Vista or later) and sync the files or folders they link to. However, any changes to those files or folders made from the Windows operating system will not sync again until the Dropbox desktop application is restarted.

The reason this is so is because Windows only creates file-system events on the real end of a Junction Point, and not on all the paths.

Keeping Folders Inside Dropbox Folder

The other option is to move everything into the Dropbox folder –

1. After the creation of a website, move its Websites\\ folder into Dropbox\.

Then, in its original place create an NTFS Junction Point into Dropbox\Websites\\.

mklink /j C:\WampDeveloper\Websites\ C:\path-to\Dropbox\Websites\

2. Move the Database\ folder into Dropbox\, and either:

A) create NTFS Junction Point in its original place into Dropbox\Database\.

mklink /j C:\WampDeveloper\Database C:\path-to\Dropbox\Database

B) or update all Config\Mysql\my-*.ini files to use the Dropbox path.

datadir = "C:\path-to\Dropbox\Database\mysql-data-*"

(and any other “\Database\” paths)

For WampDeveloper, note to reflect the accompanying MySQL version in “*”.

Notes and Limits

1. The mklink command will create the source folder as a Junction Point / Directory, with the link being made into the target folder…
A. The source folder must not exist, or has to be already deleted (mklink command will neither reform nor delete it).
B. The target folder has to already exist (mklink command will not create it).

2. Only Administrators can use mklink. Open command-line via “Run as admin”.

3. Junction Points can only point to folders and volumes.

4. Junction Points can only link across local volumes.