Skip to main content

Advanced file renaming tool with regex and case transformation support

Project description

renx - Advanced File Renaming Tool

Python Version

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

  1. Dry-run preview (default behavior):

    python -m renx /path/to/files
    
  2. Convert filenames to lowercase:

    python -m renx --lower /path/to/files
    
  3. Actually perform renames (disable dry-run):

    python -m renx --act --lower /path/to/files
    
  4. 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:

  1. Replace spaces with underscores:

    python -m renx -s '/ /_/g' /path/to/files
    
  2. Remove special characters:

    python -m renx -s '/[^a-zA-Z0-9.]//' /path/to/files
    
  3. Add prefix to numbered files:

    python -m renx -s '/(\d+)/image_$1/' *.jpg
    
  4. Case-insensitive extension fix:

    python -m renx -s '/\.jpe?g$/.jpg/i' *
    

Filtering Options

  1. Process only matching files:

    python -m renx --name '*.txt' --lower /path/to/files
    
  2. Exclude directories:

    python -m renx --exclude 'temp/*' /path/to/files
    
  3. 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

renx-0.0.2.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

renx-0.0.2-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

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

Hashes for renx-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8ed8d67c1d350909c59cfd320c2cb1f5e816ae451e362c1ba08762e0992f7546
MD5 f472eb6d446781a2f68d1ae168c527b9
BLAKE2b-256 d3fbacc8001387119b52a95644b4b607b0c91eb13399d1cd8e83ccaf4ad0680e

See more details on using hashes here.

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

Hashes for renx-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71b44ebe8485ae45757e05bb0770c88a577bd68f2eb92929bf84a58ea28724a0
MD5 6ddcdc8802928e6e76aa7e7f7b819be0
BLAKE2b-256 aaae743785ef468f06607d0d59a353b00c0c0e7062dd9773dbc1b3c0aebcf025

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page