A file and directory backup tool
Project description
file_dir_backup
file_dir_backup 是一个用于文件和目录备份的 Python 第三方库,支持全量备份和增量备份,同时支持 rsync 和 shutil 两种备份方法。
安装
pip install file_dir_backup
使用方法
命令行使用
# 查看帮助
$ file_dir_backup -h
usage: file_dir_backup [-h] [--backup-type {full,incremental}] [--method {rsync,shutil}] [--compress] [--bandwidth-limit BANDWIDTH_LIMIT] source destination
File and directory backup tool
positional arguments:
source Source directory to backup
destination Destination directory for backup
optional arguments:
-h, --help show this help message and exit
--backup-type {full,incremental}
Backup type: full or incremental
--method {rsync,shutil}
Backup method: rsync or shutil
--compress Compress data during transfer
--bandwidth-limit BANDWIDTH_LIMIT
Limit the bandwidth in KB/s
$ file_dir_backup /path/to/source /path/to/destination --backup-type full --method rsync --compress --bandwidth-limit 1000
# 全量同步示例:
#file_dir_backup /home/hujianli/test/ /home/hujianli/backup/ --backup-type full --method rsync --compress --bandwidth-limit 1000
# 或者
python -m file_dir_backup /path/to/source /path/to/destination --backup-type full --method rsync --compress --bandwidth-limit 1000
# 增量同步示例:
# python -m file_dir_backup /home/hujianli/test/ /home/hujianli/backup/ --backup-type incremental --method rsync --compress --bandwidth-limit 1000
Python 代码使用
from file_dir_backup import backup
backup('/path/to/source', '/path/to/destination', backup_type='full', method='rsync', compress=True, bandwidth_limit=1000)
测试
测试代码在 tests 目录下,使用 unittest 模块进行测试。
python -m unittest test.test_file_dir_backup
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
file_dir_backup-0.1.0.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file file_dir_backup-0.1.0.tar.gz.
File metadata
- Download URL: file_dir_backup-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31ed2e75e2a42429ddeee83a1f7142e950309f02b09e861e39df881bfe9f0f43
|
|
| MD5 |
941057f066faada547690b217e554cb1
|
|
| BLAKE2b-256 |
e54a5383675651589f9bdebb9973416f9f60dfaf4068f6b1675a934361d24c0f
|
File details
Details for the file file_dir_backup-0.1.0-py3-none-any.whl.
File metadata
- Download URL: file_dir_backup-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77eb14a8e214b58e47d62161336ee747737ba9e3ec22097ee5cd58ebc800eb23
|
|
| MD5 |
99e553441781aaa926526fe2d0b2b0d8
|
|
| BLAKE2b-256 |
9416a64a3ac2e071f3f21a71e642e6a81c6ea029c0098436cd197892f046c128
|