Renum is a simple and efficient tool written in Go, designed to rename and renumber files in a directory. It's particularly useful for renaming series of files with a specific pattern.
- Rename files in a directory based on a specific pattern.
- Preview the changes before applying them.
- Never overwrites a file: a batch that would destroy data is refused upfront.
- Easy to use with a simple command line interface.
renum is available for Windows, Linux and macOS. You can download the latest version from the releases page.
To install Renum, you need to have Go installed on your machine. Once you have Go installed, you can download and install Renum using the go get command:
go install github.com/alphayax/renum@latestYou can also use Renum with Docker. To do so, you can run the following command:
docker run --rm -it -v /path/to/directory:/data alphayax/renum:latest [options] /dataTo use Renum, run the following command by passing the path to the directory containing the files you want to rename as last argument:
renum [options] /path/to/directory-s <NUM>,--season <NUM>: The season number to use.-e <NUM>,--episode <NUM>: The episode number to start from. Will be incremented for each file.-h,--help: Display the help message.--force: Don't ask for confirmation before applying the changes.--verbose: Increase logs verbosity.--json: Display logs in JSON format.--dry-run: Preview the changes without applying them.--pattern <REGEX>: Use a custom file pattern. (Will replace all the default file pattern detected)
S[0-9]+E[0-9]+: containingS1E01orS01E01.[0-9]{1,2}x[0-9]+: containing1x01or01x01.^E[0-9]+: starting byE01orE001...[_ ][0-9]+[_ .]: containing_01_or_001_or_0001_or01or001...
You can use your own file pattern detection by using the
--patternflag with your custom regex. For example:--pattern "Season.[0-9]+.Ep.[0-9]+"to match "Season 4 Ep 21"
Renaming a batch of files can silently destroy data, so Renum checks the whole batch before touching a single file, and aborts without any change if:
- two files would end up with the same name;
- a new name would overwrite a file that the batch does not rename away.
These checks also run in --dry-run, so a preview tells you whether the batch is
safe to apply.
Renum renames files in an order that keeps every file, which means shifting a
range of episodes works in both directions. For instance, --episode 2 on a
folder holding S01E01 and S01E02 yields S01E02 and S01E03 without losing
the original S01E02.
Sub-folders are ignored: only the files directly inside the given directory are renamed, and they never get a name that would move them out of it.
0: success, or nothing to rename.1: invalid arguments, unreadable folder, invalid--pattern, unsafe batch, operation declined at the confirmation prompt, or a rename failure.
Let's say you have a directory containing the following files:
[XXX-Fansub]_Xxx_Xxxxx_1086_[VOSTFR][FHD_1920x1080].xxx
[XXX-Fansub]_Xxx_Xxxxx_1087_[VOSTFR][FHD_1920x1080].xxx
[XXX-Fansub]_Xxx_Xxxxx_1088_[VOSTFR][FHD_1920x1080].xxx
To rename these files, you can run the following command:
renum --season 12 --episode 1 /path/to/directoryThis will rename the files to:
[XXX-Fansub]_Xxx_Xxxxx_S12E01_[VOSTFR][FHD_1920x1080].xxx
[XXX-Fansub]_Xxx_Xxxxx_S12E02_[VOSTFR][FHD_1920x1080].xxx
[XXX-Fansub]_Xxx_Xxxxx_S12E03_[VOSTFR][FHD_1920x1080].xxx
To run the tests for Renum, navigate to the project directory and run the following command:
go test ./...Contributions are welcome! Please feel free to submit a Pull Request.
Feel free to send crypto donations to the following addresses:
- Solana (SOL):
HUC9MmKR6iCtxu25h8hsgnVqXzeQMTK9ThQSLMFYNJBC - Ethereum (ETH):
0xc12Ef701Dd7e5060f441b30fE569D8D7E8a230a7 - Bitcoin (BTC):
bc1qv7g3d8u9svn4w0pzfjafa7jzyglwjfkzjuc73g
