Zero pad numeric filenames
Go to file
IamTheFij 3af2427b5d
continuous-integration/drone/push Build is passing Details
Update pre-commit hooks
2022-04-04 20:20:38 -07:00
tests Rename again 2021-02-05 22:39:20 -08:00
.drone.star Drop python 3.6 tests 2021-02-05 23:02:12 -08:00
.gitignore Initial commit 2021-02-06 00:43:31 +00:00
.pre-commit-config.yaml Update pre-commit hooks 2022-04-04 20:20:38 -07:00
LICENSE Initial commit 2021-02-06 00:43:31 +00:00
Makefile Update pre-commit targets 2021-02-05 22:38:41 -08:00
README.md Add alternate install instructions 2021-02-08 09:11:49 -08:00
padio.py Initial working commit with some tests 2021-02-05 18:32:04 -08:00
requirements-dev.txt Add pre-commit to dev requirements 2021-02-05 18:34:41 -08:00
setup.py Bundle module in setup 2021-02-08 09:08:42 -08:00
tox.ini Drop python 3.6 tests 2021-02-05 23:02:12 -08:00

README.md

padio

Zero pad numeric filenames

Turn a bunch of files like this:

file1.txt
file10.txt
file5.txt

and want them to be sorted like this:

file01.txt
file05.txt
file10.txt

you can run:

padio *.txt

Installation

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

pip3 install padio

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

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

Usage

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 https://git.iamthefij.com/iamthefij/padio.git