https://github.com/fspv/google-drive-sync
Synchronize local files to corresponding Google Drive locations
https://github.com/fspv/google-drive-sync
google-drive-api
Last synced: 2 months ago
JSON representation
Synchronize local files to corresponding Google Drive locations
- Host: GitHub
- URL: https://github.com/fspv/google-drive-sync
- Owner: fspv
- Created: 2023-02-04T18:19:25.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T22:01:28.000Z (about 2 years ago)
- Last Synced: 2025-01-10T12:16:28.801Z (4 months ago)
- Topics: google-drive-api
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Synchronize local files to corresponding Google Drive locations.
The app is currently best effort and fails loudly in case things went wrong.
The synchronization works both ways and is based on file timestamps. Whichever file has the largest modified time wins and get synchronized. Having that in mind - beware of data races and race conditions. Not suitable for data that might be edited from multiple places simultaneously.
Installation
============Install google api client
```
pip install google-api-python-client
```Auth is a tricky part here. The best I managed to come up so far is:
```
gcloud auth revoke
gcloud auth login --enable-gdrive-access
export GOOGLE_APPLICATION_CREDENTIALS=${HOME}/.config/gcloud/legacy_credentials//adc.json
```
Let me know if there is an easier way.Running
=======Usage:
```
$ python3 google-drive-sync.py --help
usage: google-drive-sync.py [-h] -s SYNC [SYNC ...] [-i INTERVAL]Synchronise specified files the with corresponding Google Drive documents
options:
-h, --help show this help message and exit
-s SYNC [SYNC ...], --sync SYNC [SYNC ...]
Local file path and Google Drive file id separated by comma
-i INTERVAL, --interval INTERVAL
How often to check for changes (in seconds)
```Example:
```
./google-drive-sync.py -s test.txt,1xX-XXXXXXXX_YYYYYYYY -s test2.txt,AAAAAAAAAA_BBBBBBBBBB -i 30
```TODO
====- [ ] Make async to support syncing many files in parallel
- [ ] Introduce inotify + subscribe to Google Drive notifications to avoid busy-waiting for changes