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)
Metadata
Release files for h3a 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h3a-0.3.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h3a-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / h3a-0.3.0.tar.gz
| Download URL | h3a-0.3.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc6aec3e8ed5306340010c84036652cd1c68991b1094b619fa06387403080a05
|
|
BLAKE2b-256 checksum How to use checksums |
d4d9c565cc4008e28c05a9e9887d0b7786ffa17168a92d04d0c95217d50ad746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|
Release files / h3a-0.3.0-py3-none-any.whl
| Download URL | h3a-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8b9e8654a4323b2dd079f0bb856168fa2f10b573f3edf6f2f2aaf50b5d41d94
|
|
BLAKE2b-256 checksum How to use checksums |
50cc804fe090c8cebb85c83484ceb02073726e1688059adf8df1d153b743acfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|