Skip to main content

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_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

h3a-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

h3a-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file h3a-0.1.1.tar.gz.

File metadata

  • Download URL: h3a-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for h3a-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cde6372c6a30449b69aeeb2fed95566872a8a19b496af1b0ebdbdcea24aa1b4a
MD5 5366893ee7031491d57e6835b6a6111e
BLAKE2b-256 62650134c8901c0e073648d29a9a0ef655c32000ee0beb350e9272134596bcc5

See more details on using hashes here.

File details

Details for the file h3a-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: h3a-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for h3a-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a916b251853e177bda43d082e9d4aa0ba37177d72a3035e9c53615deb65f4a9
MD5 336b760019bf4c54fd381392ed08bb06
BLAKE2b-256 2c17910c32c007aef05d959f5e6ee7ffdddbc9b6b8ca882b52662f4659e669d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page