A simple script for file archiving.
Project description
h3a
A simple script for file archiving.
- Python: >=3.12
- Test Coverage: 100%
- Well Typed: Yes
- License: ISC
Usage
$ h3a --help
Usage: h3a [OPTIONS]
A simple script for file archiving.
Options:
-c, --config FILE Path to config file. [default: h3a.yaml]
-e, --encoding TEXT Encoding of the config file. [default: utf-8]
--help-config Show config schema and exit.
-y, --skip-confirm Skip confirmation prompt.
-t, --threads INTEGER RANGE Number of threads to use. [x>=1]
--dry-run Print plan and exit.
--verbose Enable info-level logging.
--debug Enable debug-level logging.
--version Show the version and exit.
--help Show this message and exit.
Example
Say you wanna archive all the Office files in the current directory except the ones starts with _:
some_directory/
+-- foo.docx
+-- bar.pptx
+-- baz.xlsx
`-- _blah.docx
You can first create a config file h3a.yaml:
# h3a.yaml
include:
- '**/*.docx'
- '**/*.pptx'
- '**/*.xlsx'
exclude:
- '_*.*'
on_conflict: overwrite
Then, execute h3a in the directory and confirm the archive plan:
h3a
Now you get your files archived: (The actual time tag differs.)
some_directory/
+-- h3a.yaml
+-- foo.docx
+-- foo_v20251024-123456.docx
+-- bar.pptx
+-- bar_v20251024-123456.pptx
+-- baz.xlsx
+-- baz_v20251024-123456.xlsx
`-- _blah.docx
Configuration Schema
$ h3a --help-config
include (list[str]):
An array of glob patterns to include.
exclude (list[str], optional):
An array of glob patterns to exclude. (default: [])
out_dir (str, optional):
The output path prefix.
tag_time_source (typing.Literal['now', 'mtime', 'ctime'], optional):
The source of the timestamp in the dest tag. (default: 'mtime')
tag_format (str, optional):
The strftime format of the dest tag. (default: '_v%Y%m%d-%H%M%S')
tag_pattern (str, optional):
A regex pattern to match existing dest tags. (default: '_v\\d{8}-\\d{6}')
on_conflict (typing.Literal['error', 'skip', 'overwrite'], optional):
The action of existing dest files. (default: 'error')
threads (int, optional):
The number of maximum threads to use. (default: 8)
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
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 h3a-0.3.0.tar.gz.
File metadata
- Download URL: h3a-0.3.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc6aec3e8ed5306340010c84036652cd1c68991b1094b619fa06387403080a05
|
|
| MD5 |
92aa9d140dc9f9d92c1d9c40908be7b5
|
|
| BLAKE2b-256 |
d4d9c565cc4008e28c05a9e9887d0b7786ffa17168a92d04d0c95217d50ad746
|
File details
Details for the file h3a-0.3.0-py3-none-any.whl.
File metadata
- Download URL: h3a-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8b9e8654a4323b2dd079f0bb856168fa2f10b573f3edf6f2f2aaf50b5d41d94
|
|
| MD5 |
4ff22727e0579b1b60aeeb4705b5f840
|
|
| BLAKE2b-256 |
50cc804fe090c8cebb85c83484ceb02073726e1688059adf8df1d153b743acfd
|