Zero pad numeric filenames
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
IamTheFij 3af2427b5d Update pre-commit hooks 2 months ago
tests Rename again 1 year ago Drop python 3.6 tests 1 year ago
.gitignore Initial commit 1 year ago
.pre-commit-config.yaml Update pre-commit hooks 2 months ago
LICENSE Initial commit 1 year ago
Makefile Update pre-commit targets 1 year ago Add alternate install instructions 1 year ago Initial working commit with some tests 1 year ago
requirements-dev.txt Add pre-commit to dev requirements 1 year ago Bundle module in setup 1 year ago
tox.ini Drop python 3.6 tests 1 year ago


Zero pad numeric filenames

Turn a bunch of files like this:


and want them to be sorted like this:


you can run:

padio *.txt


Padio can be run on any system that includes Python 3 after installation with pip:

pip3 install padio

Or by downloading ./ and placing it anywhere in your $PATH.

Note: I have not tested on Windows, but would welcome feedback or a patch


usage: padio [-h] [-l LENGTH] [-f] [-v] [-d] [-i REGEX] [--ignore-files IGNOREFILE [IGNOREFILE ...]] file [file ...]

Pads numbers in file names so they consistently align and sort

positional arguments:
  file                  Files to be renamed

optional arguments:
  -h, --help            show this help message and exit
  -l LENGTH, --length LENGTH
                        Length of numbers after padding (default: auto)
  -f, --force           Force rename, even if file at destination exists
  -v, --verbose         Print all actions
  -d, --dry-run         Print actions only without modifying any file. Implies --verbose
  -i REGEX, --ignore REGEX
                        Regular expression used to ignore files matching the name
  --ignore-files IGNOREFILE [IGNOREFILE ...]
                        Files to ignore for renaming. Must add -- before positional arguments

Original repo

Originally hosted at