Skip to content

apancoast/backup-er

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Backup to Google Drive

Overview

This script automates the process of backing up a file or directory to Google Drive. It zips directories, uploads them to a designated Google Drive folder, and keeps your backups tidy by automatically deleting older ones.

I created it for making weekly backups of my Obsidian vault.

Features

  • Supports files and directories – Zips directories before upload.
  • Google Drive integration – Uses pydrive2 for authentication and upload.
  • Automatic cleanup – Retains only the two most recent backups.
  • Logging – Keeps a log of all backup actions.
  • Smart ZIP deletion – Deletes the ZIP file if it was created during the process.

Future Plans

  • Add a bash script to automate execution.
  • Use Task Scheduler (Windows) for scheduled backups, with instructions on setup.
  • Replace the log file instead of appending to it every time.

Requirements

  • Python 3.x
  • pydrive2 (pip install pydrive2)
  • Google Drive API authentication (OAuth setup required)

Platform Compatibility

This script was developed and tested on Windows 10. It may work on other operating systems, but it hasn't been tested outside of Windows. Adjustments may be needed for macOS/Linux, especially for file paths and task scheduling.

Usage

Run the script from the command line:

python backup.py "C:\path\to\your\ObsidianVault"

Setup for Windows 10 Task Scheduler (Planned)

To automate this process, a scheduled task will be configured to run the script at a set interval. Instructions will be added soon!

Notes

  • The first time you run this script, it will prompt you to authenticate with Google.
  • Adjust the backup_folder variable in the script if you want a custom Google Drive folder name.

Contributing

Feel free to suggest improvements or fork the repo for your own modifications!

About

Python script to automate backing up a file or directory to Google Drive.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages