Backup a file or directory, defaults to same path with suffix .bak
Project description
bak
usage: bak [-h] [-a APPEND] [-d] [-f] [-u] Source
Backup a file or directory, defaults to same path with suffix .bak
positional arguments:
Source file to backup
optional arguments:
-h, --help show this help message and exit
-a APPEND, --append APPEND
characters to append to source file instead of .bak
-d, --date add the date .YYYYMMDD to the end of the file
-f, --force overwrite backup if exists
-u, --unbak Unbak a file to its original location, force overwrite
(if your filesystem supports extended file attributes)
unbak
usage: unbak [-h] Source
Restore a file created by bak, this is the same as bak -u
positional arguments:
Source bak file to restore
optional arguments:
-h, --help show this help message and exit
Install
Install using pip https://pypi.org/project/bak/
# See if pip is install
python3 -m pip --version
# Try and install it
python3 -m ensurepip --default-pip
# Install bak
python3 -m pip install bak
unbak, bak -u
bak -u allows you to restore a file backed up using bak.
By default bak creates metadata on the .bak file https://en.wikipedia.org/wiki/Extended_file_attributes
bak would then try to restore to the path stored in the metadata, if the metadata is removed, this wont work.
Notes
It is really easy to lose the metadata, and you need to take active measures to preserve metadata if moving/copying the backup file.
http://www.lesbonscomptes.com/pages/extattrs.html
mv preserves xattrs cp will only preserve xattrs if given the option --preserve=xattr rsync 3.0.9 with option -X or --xattrs will preserve attributes
If copying to a filesystem that does not support metadata (tmpfs for example) metadata will be lost
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bak-0.4.3.tar.gz
.
File metadata
- Download URL: bak-0.4.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b72e8b34b8954f758b1a5ec8f876f556df8a626d14241d8f14c6ef74fd0c3a57 |
|
MD5 | cef8af44c6eb3ea0bb999d44d3478a3c |
|
BLAKE2b-256 | 5381bdb936fff2900527db8ecb8fbba7dcf8df37f92e20e8bec17450b06465fe |
File details
Details for the file bak-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: bak-0.4.3-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad167c2ad28afa37648a595e9afeb0821dfe1b2eeeb2ccd4f6418872b9c106b |
|
MD5 | ad3b0978a9e175212f060326d49af2e4 |
|
BLAKE2b-256 | 09ab5ee12fc4ab544cb5334b93cda3a94e589cb74e01422be4732915c31f0560 |