Last active
January 9, 2023 04:25
-
-
Save natterstefan/7565c1de6c21ee982bd69942de579292 to your computer and use it in GitHub Desktop.
Raspberry Pi | Setup gdrive to sync local folder to Google Drive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# gdrive client: https://github.com/gdrive-org/gdrive | |
# inspired by https://github.com/gdrive-org/gdrive/issues/205#issuecomment-423759052 | |
# Create directory ~/backups (must be empty at the beginning) | |
rm -rf ~/backups && mkdir ~/backups | |
# upload it the first time into a parent directory | |
# 1234 => id of the parent directory on google drive | |
# eg. https://drive.google.com/drive/u/0/folders/1234 | |
./gdrive upload -p 1234 -r backups | |
# get the list of the last uploaded files and directories | |
gdrive list -m 1 | |
# Id Name Type Size Created | |
# 45678 backups dir 2018-09-22 18:59:26 | |
# copy the id from the previous command and start syncing | |
./gdrive sync upload --delete-extraneous ~/backups 45678 | |
# Starting sync... | |
# Collecting local and remote file information... | |
# Found 0 local files and 0 remote files | |
# Sync finished in 6.312699642s | |
# get a list of all synced folders | |
gdrive sync list | |
# Id Name Created | |
# 45678 backups 2018-09-22 18:59:26 | |
# see backup.sh for the next step: https://gist.github.com/natterstefan/45a79301937026d4df0e12b4a1095ea4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment