Skip to main content

Advanced file renaming tool with regex and case transformation support

Project description

renx - Advanced File Renaming Tool

Python Version PyPI version fury.io

renx is a powerful command-line utility for batch renaming files and directories with advanced pattern matching and transformation capabilities.

☕ Support

If you find this project helpful, consider supporting me:

ko-fi

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.3.tar.gz (25.6 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.3-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file renx-0.0.3.tar.gz.

File metadata

  • Download URL: renx-0.0.3.tar.gz
  • Upload date:
  • Size: 25.6 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.3.tar.gz
Algorithm Hash digest
SHA256 5de086675bedc5bae46305e7bf4a8df3f5de6b9463df33d3033342ced3f6abaa
MD5 224e7896c39e8a8f39d8b493a90b3f09
BLAKE2b-256 7fd3e6b4581076f9d93efef80cec77c04b0b5026610419e5af4f3583923297c0

See more details on using hashes here.

File details

Details for the file renx-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: renx-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7611d7f1cdba03a38b1f173c727a86a18c94c7905e84a7901283e4c3495e1c3b
MD5 ef80b0b6c34be28a6e80af2257af65d1
BLAKE2b-256 0fe2d51e1b1f66793839821a8b2c3fe374c99cc7d318cf8ab7aca60e2ad21190

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