This a simple strategy I use to implement two-way syncing with dropbox using
Rclone. It's not perfect but thanks to the revision
history feature in dropbox and the
--backup-dir in Rclone it works well
enough for me.
Here is a simplified version of my
sync.sh script with some comments
# An exclude file I use to mainly ignore temporary files such as vim's *.swp, # libre offices .~lock.* files, etc. EXCLUDE_FILE=/path/to/exclude # Sync location for my dropbox account DROPBOX=/path/to/dropbox # A local backup location. I use the --backup-dir flag when syncing down from # dropbox. If rclone is going to overwrite any of my local files it will make a # copy to this folder before so. This is handy as it means that I won't lose # data in the event that both the remote and my local file changes. DROPBOX_BACKUP=/path/to/dropbox-backup # I sync from dropbox pulling any changes as long as they are newer in dropbox # (-u). If rclone is overwriting any files it will put them into the backup # folder and add the current datetime as a suffix (poor man's revision history!). rclone copy -u -v rednim-dropbox: $DROPBOX \ --backup-dir $DROPBOX_BACKUP \ --suffix .$(date +"%Y-%m-%d-%H-%M-%S") # I then sync up dropbox with my local changes excluding any garbage files rclone sync -v $DROPBOX dropbox: --exclude-from $EXCLUDE_FILE
Overall this is a decent strategy. My local changes will only get updated if they are newer in dropbox. I backup the files in the event that my local is changed but the dropbox is still newer (conflict). I just recover the files from my backup and resolve the conflict manually. The reverse can happen in dropbox when I sync back my changes but dropbox generously provides a version history on their site which allows me to recover files in that scenario.
With the copy down, sync up strategy it requires a little more effort when deleting. Since copying down won't delete any files from my local I have to make sure I delete them locally when they are deleted on the remote.
This works for me as I have several dropbox accounts and the default client only
supports 2 (personal & business). There is currently a work-around
where you can run different instances of the dropbox client with a different
$HOME variable but I prefer this approach, I don't need to run multiple
dropbox clients and have them continuously syncing (and breaking).
I also like that with Rclone I can control where to sync my dropbox data.
The only downside is that syncing is not automatic. I have to manually run the script or put it on a timer but my interaction with dropbox is limited so it is an acceptable trade-off for me.