TidyBatch
Bulk rename files without the fear. Preview every change, apply it, and undo it with one command.
Most bulk-rename scripts have a silent bug: renumber 1.txt 2.txt 3.txt → 2.txt 3.txt 4.txt and the first mv overwrites the original 2.txt. TidyBatch is built around not doing that:
- Dry run by default. Nothing changes until you add
--apply. - One-command undo. Every applied run is journaled;
tidybatch undo <folder>puts every file back. - Never overwrites. Two-phase renames make chains and swaps safe; clashes get
_1,_2, … - Case-insensitive collision checks, because Windows and macOS treat
Photo.JPGandphoto.jpgas the same file. - One file, standard library only. No dependencies: you can read all of it before you trust it with your photos.
New to bulk renaming? Read the tested guides at tidybatch.github.io/guides: how to rename safely on any OS, how to undo a bulk rename, and how to add dates to file names.
Install
pipx install tidybatch
# or: uv tool install tidybatch
# or: pip install tidybatch
# or just download tidybatch.py and run: python3 tidybatch.py --help
Try it on a folder without installing anything permanent (it's a preview, so nothing changes):
uvx tidybatch rename ~/Downloads --slug --lower
Recipes
# Clean names: no accents, spaces or symbols, all lowercase
tidybatch rename ~/Downloads --slug --lower
# Number photos in date order: holiday_001.jpg, holiday_002.jpg, …
tidybatch rename ./photos -g "*.jpg" --sort date -t "holiday_{n:03}{ext}"
# Put the file date in front: 2024-08-12_invoice.pdf
tidybatch rename ./invoices -t "{date:%Y-%m-%d}_{stem}{ext}"
# Name photos by when they were TAKEN (EXIF): 2023-07-14_182205.jpg
tidybatch rename ./camera -t "{taken:%Y-%m-%d_%H%M%S}{ext}"
# Regex with groups: IMG_2024_0001.jpg -> 2024-photo-0001.jpg
tidybatch rename . --find "IMG_(\d{4})_(\d+)" --replace "\1-photo-\2"
# Happy with the preview? Run it for real, then change your mind
tidybatch rename ~/Downloads --slug --lower --apply
tidybatch undo ~/Downloads
Template fields: {stem} {ext} {n} (counter, e.g. {n:03}) {date} (modification date, e.g. {date:%Y%m%d}) {taken} (photo date taken from EXIF, falling back to {date}) {today} {parent} {size_kb}
Options: -r sub-folders · -g "*.jpg" filter · --hidden include hidden files · --sort name|date|taken|size · --start N · --apply
Photo dates: {taken} reads EXIF with the standard library only, with no Pillow or exiftool needed. Every CI run checks it against ExifTool on ExifTool's own sample images (JPEG, HEIC, TIFF, DNG, CR2, CR3, NEF, RW2, RAF: same date for every file, dev/verify_exif.py) and feeds it 20,000 corrupted files, which must never crash or hang it (dev/fuzz_exif.py). Dates stored only in XMP/IPTC aren't read; those files fall back to the modification date.
How it stays safe
- Plan: compute every new name without touching the disk, then resolve collisions. A destination is free only if nobody else claimed it and whatever is there now is itself moving away.
- Phase 1: every file moves to a temporary name in the same folder.
- Phase 2: every temporary file moves to its final name, refusing to overwrite anything that appeared in the meantime.
- Journal:
<folder>/.tidybatch/journal-*.jsonrecords each completed move, even if the run is interrupted, soundocan replay it backwards.
How it's made
Most of the code was written with an AI coding agent. The behaviour that protects your files (two-phase moves, collision checks, undo) is pinned down by the test suite, which runs on Linux, macOS and Windows on every push.
TidyBatch Pro
This repository is TidyBatch Core (rename + undo), free and MIT-licensed. TidyBatch Pro adds:
organize: sort a folder into Images / Documents / Videos…, by year/month (modified or photo date taken), or by extensiondedupe: find exact duplicates by content (SHA-256), keep the oldest, move the rest aside (never deleted)- ready-to-run apps for Windows and Linux (no Python needed), plus free 1.x updates
Buying Pro also funds the free version. Thank you!
Contributing
Bug reports with a reproducible folder layout are gold. CONTRIBUTING.md lists what to include and explains how pull requests are merged (the Core file is generated). Security issues: SECURITY.md. Run the tests with:
python -m unittest discover -s tests
# photo-date checks (needs perl and an ExifTool checkout)
git clone --depth 1 https://github.com/exiftool/exiftool /tmp/exiftool
python dev/verify_exif.py /tmp/exiftool
python dev/fuzz_exif.py /tmp/exiftool
License
Metadata
Release files for tidybatch 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tidybatch-1.1.2.tar.gz | 15.9 kB | With provenance | Details for tidybatch-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tidybatch-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for tidybatch-1.1.2-py3-none-any.whl |
Total release size: 29.2 kB
Release files / tidybatch-1.1.2.tar.gz
| Download URL | tidybatch-1.1.2.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b1e5da1e96e58231defbd43d6591e80e736b4cdcc9bb9fafde1065e7dead7d3
|
|
BLAKE2b-256 checksum How to use checksums |
a62e83547d622a3eb951c53eb692785e3af76d394316fb0d9d498ac0a8e79ef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / tidybatch-1.1.2-py3-none-any.whl
| Download URL | tidybatch-1.1.2-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
499df9718799e5f9cbc77005df97eb3daa289c99c326c8cef29f7f8ddc4f14f2
|
|
BLAKE2b-256 checksum How to use checksums |
e9325e67636f7035f2360d6b26cf3fefeded621be606554e26360b07c5f838d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for tidybatch 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tidybatch-1.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.