https://github.com/anmol-singh-jaggi/gdrive-auto-sync
:cloud: :floppy_disk: Automatically backup files to your Google Drive account periodically
https://github.com/anmol-singh-jaggi/gdrive-auto-sync
backup directory google-drive python
Last synced: about 1 month ago
JSON representation
:cloud: :floppy_disk: Automatically backup files to your Google Drive account periodically
- Host: GitHub
- URL: https://github.com/anmol-singh-jaggi/gdrive-auto-sync
- Owner: Anmol-Singh-Jaggi
- License: mit
- Created: 2016-01-05T07:49:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-28T11:12:34.000Z (over 7 years ago)
- Last Synced: 2025-02-06T12:05:48.640Z (3 months ago)
- Topics: backup, directory, google-drive, python
- Language: Python
- Homepage:
- Size: 139 KB
- Stars: 17
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gDrive-auto-sync
Automatically backup files to your Google Drive account periodically.
#### Demo:
[](http://www.youtube.com/watch?v=q40_A01v470)
**Dependencies:**
- `pip install google-api-python-client`**Usage:**
- Download your *`client_secrets.json`* file from the Google Developer Console and keep it alongside the script.
To do this, perform the following steps:
- Go to [this link](https://console.developers.google.com/project) and make a new project.
- In the project settings, turn *Drive API* on.
- In the credentials settings, create an OAuth client ID (choose the application type as *Other*).
- Click on the *Download JSON* link and save it as *client_secrets.json* in your working directory.
- Replace the value of the *APPLICATION_NAME* variable in the *`api_boilerplate.py`* file with the name of the project created in the previous step.
- Add the details regarding the files to be uploaded in the *`file_list.json`* file. For new files, keep the `fileId` empty and `parentId` as the ID of the Drive directory in which the file has to be inserted.
The ID of a directory can be found by visiting that directory on Google Drive and looking at the alphanumeric string in the URL.

- Modify *`custom_cmds_pre.sh`* and *`custom_cmds_post.sh`* as per your needs.
- Make sure that the main script is executable - `chmod +x ./run.sh`.
- For manually running it, just cd into the directory and execute the main script - `./run.sh`.
If you are running it for the first time, you will be asked to authenticate yourself with Google.
- For scheduling it using [cron](https://en.wikipedia.org/wiki/Cron):
- Modify the contents of *`crontab.txt`* as per your needs.
- Execute `crontab -e` to open the crontab edit buffer.
- Copy the contents of *`crontab.txt`* in the buffer and save it.
- ***TIP:*** In case you need to execute [notify-send](http://ss64.com/bash/notify-send.html) from cron, follow the steps given [here](https://anmolsinghjaggi.wordpress.com/2016/05/11/notify-send-in-ubuntu-16-lts/).**To-Do:**
- Add support for uploading contents of a folder recursively without archiving.
- ~~Add support for uploading a file only if it is has been modified. (By comparing hashes)~~