A CLI tool to help batch renaming of files.
-
Get the ZIP or clone the repo:
gh repo clone POWRFULCOW89/batch-rename
-
Initialize a virtual environment:
python -m venv env
And activate it:
.\env\Scripts\activate
-
Install the dependencies:
(env) pip install -r requirements.txt
-
Run the tests:
(env) python test.py
-
Build from source:
(env) pyinstaller --onefile main.py
Or grab the latest release.
-
(Optional) Add the binary file to PATH.
-
Help flag:
batch-rename -h
Outputs:
usage: batch-rename.exe [-h] [-n] [path] substring [new_string] Batch rename files, stripping a given substring positional arguments: path Path to directory with files to rename. Defaults to current working directory. substring Substring to strip or replace out of every file in path. new_string String to replace for every matching substring. Defaults to an empty string. optional arguments: -h, --help show this help message and exit -n Rename all files to substring and number them accordingly.
-
Strip all ocurrences of "log" in the current directory:
batch-rename log
-
Strip all ocurrences of "python" in an absolute path:
batch-rename "C:/Users/<you>/Documents/PDF" python
-
Rename all files in the "Songs" subdirectory numerically with a starting string:
batch-rename Music/Songs "Track - " -n
-
Replace all ocurrences of "log" with "report" in the current directory:
batch-rename ./ log report
- RegEx support