Skip to main content

Backup, restore, version control local data to google drive

Project description

backup-tools

Backup, restore, version control local data to google drive

Prerequisites

  • Python >= 3.6

Install

pip install backuptools

Usage

Create config file

  1. Create and download google account service json file credentials.json for google drive service
  2. Share Google Drive folder for Service Account email
  3. Get id of Google Drive folder and put to backuptools.config.json below
  4. Create backuptools.config.json with content:
{
  "drive_credentials": "<path/to/credentials.json>",
  "drive_root_id": "<id_of_drive_folder>",
  "resources": [
    {
      "type": "GoogleDriveBackupResource",
      "name": "<resource_name>",
      "args": {
        "local_resource_path": "<path/to/local/source>",
        "local_backup_folder_path": "<path/to/local/backup/folder>",
        "drive_backup_folder_path": "<path/to/drive/backup/folder>"
      }
    }
  ]
}

Backup

With auto name

backuptools -R <resource> backup

With specific name

backuptools -R <resource> backup <version>

Restore

backuptools -R <resource> restore <version>

List version

List all local and remote version

backuptools -R <resource> ls

List local only version

backuptools -R <resource> ls --local

List remote only version

backuptools -R <resource> ls --remote

Create local version

With auto name

backuptools -R <resource> create

With specific name

backuptools -R <resource> create <version>

Extract local version

backuptools -R <resource> extract <version>

Push version

Push one local version to remote

backuptools -R <resource> push <version>

Push all local versions to remote

backuptools -R <resource> push --all

Pull version

Pull one remote version to remote

backuptools -R <resource> pull <version>

Pull all remote versions to local

backuptools -R <resource> pull --all

Sync versions

Upload all local versions to remote and download all remote versions to local

backuptools -R <resource> sync

Remove version

Remove one version on local and remote

backuptools -R <resource> rm <version>

Remove one version on local

backuptools -R <resource> rm <version> --local

Remove one version on remote

backuptools -R <resource> rm <version> --remote

Remove all version on local and remote

backuptools -R <resource> rm --all

Remove all version on local

backuptools -R <resource> rm --all --local

Remove all version on remote

backuptools -R <resource> rm --all --remote

Development

Prerequisites

pipenv install

Test

  1. Create Google Drive Service account and download json key

  2. Copy to file to path credentials/credentials.json

  3. Create file test/local_config.py with content:

ROOT_ID = "1rbi0gr7yMAFKqEgx-pBp6kKJx1Z4Tcgm"
CREDENTIALS_PATH = 'credentials/credentials.json'
  1. Test command line
./test.sh

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backuptools-1.0.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

backuptools-1.0.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file backuptools-1.0.1.tar.gz.

File metadata

  • Download URL: backuptools-1.0.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for backuptools-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b4896db06d743d35c9adb3dfa8c297f7ebc73eb830a24d38da45a9a42587188d
MD5 f42f79ef5c335cb19866a5b7788e4d48
BLAKE2b-256 5c54f8013cd2f992bc5c4c864f8397302f1eda784cdb72c63177873b826d675d

See more details on using hashes here.

File details

Details for the file backuptools-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: backuptools-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for backuptools-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b2c14e1c4eebbc8d7c165015370c5491a9a57c510c5d93ab1138944450b0ed0f
MD5 6bf1cd263664130839a4b90763f00a4e
BLAKE2b-256 dd4d60f7d80fa8d0b9134a609b322418d9463e84de55220437ebed1984f57a26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page