Advanced file renaming tool with regex and case transformation support
Project description
renx - Advanced File Renaming Tool
renx is a powerful command-line utility for batch renaming files and directories with advanced pattern matching and transformation capabilities.
Features
- Recursive directory traversal (top-down or bottom-up)
- Multiple renaming transformations:
- Case conversion (lowercase/uppercase)
- URL-safe filename generation
- Regular expression substitutions
- Flexible filtering:
- Include/exclude by glob patterns or regex
- Maximum depth control
- Safety features:
- Dry-run mode by default
- Preview changes before executing
Installation
pip install renx
Usage
python -m renx [OPTIONS] [PATHS...]
Basic Examples
-
Dry-run preview (default behavior):
python -m renx /path/to/files
-
Convert filenames to lowercase:
python -m renx --lower /path/to/files
-
Actually perform renames (disable dry-run):
python -m renx --act --lower /path/to/files
-
Make filenames URL-safe:
python -m renx --urlsafe /path/to/files
Regex Substitutions
The --subs (-s) option supports Perl-style regex substitutions:
Format: /DELIMITER/PATTERN/DELIMITER/REPLACEMENT/DELIMITER/FLAGS
Examples:
-
Replace spaces with underscores:
python -m renx -s '/ /_/g' /path/to/files
-
Remove special characters:
python -m renx -s '/[^a-zA-Z0-9.]//' /path/to/files
-
Add prefix to numbered files:
python -m renx -s '/(\d+)/image_$1/' *.jpg
-
Case-insensitive extension fix:
python -m renx -s '/\.jpe?g$/.jpg/i' *
Filtering Options
-
Process only matching files:
python -m renx --name '*.txt' --lower /path/to/files
-
Exclude directories:
python -m renx --exclude 'temp/*' /path/to/files
-
Limit recursion depth:
python -m renx --max-depth 2 /path/to/files
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file renx-0.0.2.tar.gz.
File metadata
- Download URL: renx-0.0.2.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ed8d67c1d350909c59cfd320c2cb1f5e816ae451e362c1ba08762e0992f7546
|
|
| MD5 |
f472eb6d446781a2f68d1ae168c527b9
|
|
| BLAKE2b-256 |
d3fbacc8001387119b52a95644b4b607b0c91eb13399d1cd8e83ccaf4ad0680e
|
File details
Details for the file renx-0.0.2-py3-none-any.whl.
File metadata
- Download URL: renx-0.0.2-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71b44ebe8485ae45757e05bb0770c88a577bd68f2eb92929bf84a58ea28724a0
|
|
| MD5 |
6ddcdc8802928e6e76aa7e7f7b819be0
|
|
| BLAKE2b-256 |
aaae743785ef468f06607d0d59a353b00c0c0e7062dd9773dbc1b3c0aebcf025
|