Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1.22 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.22 KB

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>