Skip to content

MAKENTNU/Backup-to-Drive

Repository files navigation

Backup-to-Drive

🛠️ Setup

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

  2. Create a .env file in the same folder as this README, and paste in the following contents:

    DRIVE_BACKUP_FOLDER_ID='<folder ID>'

    where <folder ID> is replaced with the ID of the Google Drive folder you want to upload to. (Alternatively, this ID can be provided using the -i option described below.)

  3. Install uv

  4. Install dev dependencies:

    uv sync --group dev
  5. To be able to run commands in the Makefile:

    • If using Windows:
      • Ensure that you have a program installed that can run makefiles. This can be done by e.g. installing GnuWin's Make using WinGet:
        winget install GnuWin32.Make
    • If using Linux/macOS: You don't need to do anything.

🚀 Usage

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

uv run backup_to_drive.py <filename>

If using a Unix-based operating system (like Linux or macOS), the command can also be run like:

./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

🧹 Linting

Run:

make lint

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •