For developers who have 100’s of lines in multiple dot files, backing them up is also important, I’ve seen quite a few developers who copy the files to git or explicitly sync them. This works just fine, but it’s a manual process and duplication of data. I have multiple dot files (shell files, config files, etc) and I wanted a continuous backup solution which need’s zero manual effort.
I experimented with Dropbox offical client, which found to be way easier than writing code using Dropbox’s API.
1 2 3 4 5
After the Dropbox client is up and running, create symbolic links of the directory and file you like to backup, example:
1 2 3
Dropbox will backup the actual files / directories to Dropbox.
Below is the Python code which uses Dropbox Python API to push files to Dropbox:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Click here - To create a new app and get the Dropbox access token.
When this Python files is executed it will try to push the set of files in files variable and you can see these in Dropbox app folder which you created. local property in files variable is the local file location, remote is the remote file name.
To automate this process, add the cron expression
0 * * * * /use/bin/python dropbox_backup.py in cron tab editor (
crontab -e). This will execute the Python script every one hour and pushes the files to Dropbox, however Dropbox client will only update the file in Dropbox if that’s a modified version of the existing file in Dropbox.