GithubHelp home page GithubHelp logo

zhen-huan-hu / backup Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 3.0 45 KB

A Python script to backup files in a TAR archive

License: GNU General Public License v3.0

Python 100.00%
python3 backup-script rsync tar-archive

backup's Introduction

backup

A Python script to backup files in a TAR archive with the following features:

- Compression using the LZMA method
- Differential backups based on the rsync algorithm
- Rotation of the backup files
- Choosing of specific file types or file size

This is a pure Python implementation and no additional external application is needed. Python 3.0+ is needed to run the script. The pyrsync2 module included in the package was originally written by Georgy Angelov and Isis Lovecruft and is licensed under the MIT License.

Use

Basic syntax:

backup.py -t TARGET -s SOURCE [SOURCE ...] [-e] [-d DIFF] [-c]
          [-r] [-l SIZE] [-f FILETYPE [FILETYPE ...]] [-k KEEP] [-v] [-h]

Required arguments:

-t TARGET, --target TARGET
                      target directory
-s SOURCE [SOURCE ...], --source SOURCE [SOURCE ...]
                      source directories or files

Optional arguments:

-e, --extract-mode    toggle extract mode
-d DIFF, --diff DIFF  source diff file
-c, --compress        compress the archive
-r, --rsync           create differential copies based on rsync algorithm
-l SIZE, --size-limit SIZE
                      exclude files larger than specified size, in bytes
-f FILETYPE [FILETYPE ...], --file-type FILETYPE [FILETYPE ...]
                      select file types to be archived
-k KEEP, --keep KEEP  maximum archive iterations to keep
-v, --verbose         explain what is being done
-h, --help            show help message and exit

The -c, --compress, -r, --rsync, -l SIZE, --size-limit SIZE, -f FILETYPE [FILETYPE ...], --file-type FILETYPE [FILETYPE ...], and -k KEEP, --keep KEEP arguments work under the archiving mode. The -e, --extract-mode argument toggles the extract mode. The -d DIFF, --diff DIFF argument only works under the extract mode.

For archiving large amount of data such as the entire partition, it is recommended to use -r, --rsync without -c, --compression. On contrary, using -c, --compression without -r, --rsync is more desirable for archiving a small amount of files.

License

This project is licensed under the GPL-3.0 License

backup's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

backup's Issues

Should this work?

'''
python backup.py -e -c -s /mnt/c/repos/ -t /mnt/d/
''''
I am using this to backup my folder containing git repos and make a tar file. In the 'd' mount

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.