Skip to content

Code for backing up files to a Google Drive folder; intended usage on a webserver.

License

Notifications You must be signed in to change notification settings

MAKENTNU/Backup-to-Drive

Repository files navigation

Backup-to-Drive

Setup

Start by creating a service account for your Google Cloud project.

Create a local_settings.py file in the same folder as settings.py, and define a DRIVE_BACKUP_FOLDER_ID variable with the ID of the Google Drive folder you want to upload to as value. (Alternatively, this ID can be provided using the -i option described below.)

Usage

Run the following command to upload <filename> to the previously specified folder:

python backup_to_drive.py <filename>

Options:

  • -i, --folder-id <Google Drive folder ID> - defaults to DRIVE_BACKUP_FOLDER_ID
  • -p, --no-prefix - prevents prefixing a timestamped string to the uploaded file's name

As a Bash script:

Requires having set the python3 command to a version of Python >= 3.7.

It's possible to use the provided bash script, which can be installed using the following command:

sudo ln -s <full path to this repo locally>/backup-to-drive.sh /bin/backup-to-drive

After that, it can be used in the following manner (with same options as above):

backup-to-drive <filename>

About

Code for backing up files to a Google Drive folder; intended usage on a webserver.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published