DEV Community

Cover image for Synchronize a remote Dropbox directory with a local one in Python
Samuel Viana
Samuel Viana

Posted on • Originally published at codehouse.digfish.org

Synchronize a remote Dropbox directory with a local one in Python

After the last post, in which a simple local synchronizer were implemented in Python making use of the Watchdog library to detect the local changes and propagate them to a remote directory in Dropbox, I've decided to implement a reciprocal sychronizer that does the exact opposite - synchronizes continuously a remote Dropbox location to a local one. It's using the same Dropbox Python SDK as the latter post, and of course you'll need to register an app of yours in order to create a access token to acess the Dropbox API. In this particular case, a cursor is created every 30 seconds to poll for changes on the remote location and if that is the case, the API returns the name of involved file, and replicates locally what has happenned remotely. Again, in this case, the program does not perform a global synchronization between remote and local directories, only listens to modifications in real time and propagates them one-way from remote to local.

The code is below:

Top comments (0)