Skip to main content

PyPI version Downloads License GitHub stars CI pre-commit.ci status

renux

A terminal-based bulk file renamer with a TUI

Preview

About

renux is a tool with a text-based (terminal) user interface (TUI) that automates file renaming. It simplifies this task with features like regex, placeholders, and text transformations, making it ideal for situations such as renaming photos, cleaning up download folders, or enforcing consistent naming conventions.

Features

  • Regex: perform advanced renaming with pattern matching, capturing groups, and replacements.
  • Text transformations: apply text transformations like slugify, camelCase to snake_case, and more.
  • Counter placeholders: add incremental counters (e.g., file1.txt, file2.txt) with customizable starting points, increments, and padding.
  • Date placeholders: include file creation/modification dates or the current date in filenames with customizable formats.
  • File size placeholders: include a file's size, auto-scaled to the largest sensible unit or a specific one (bytes, KB, MB, GB).
  • Image placeholders: include an image's width and height in pixels, plus EXIF capture date and camera make/model when available.
  • Location placeholders: include a photo's GPS latitude, longitude, and altitude from EXIF data when available.
  • Video placeholders: include a video's width, height, frame rate, and duration.
  • Backup and undo/redo: save and restore changes to your files.
  • File exclusion: exclude files from renaming.
  • Keyboard shortcuts: use hotkeys to quickly apply actions and navigate the UI.

Installation

Using pipx (recommended).

pipx install renux

Alternatively, you can use pip.

Usage

renux [directory] [pattern] [replacement]

Arguments

  • directory: Directory where files are located (default is the current directory or .).
  • pattern: Search pattern, which can be a regular expression (default is '').
  • replacement: Replacement string for the pattern (default is '').

Options

  • -c COUNT, --count COUNT: Max replacements per file (default is 0, meaning unlimited).
  • -r, --regex: Treats the pattern as a regular expression (default is True).
  • --case-sensitive: Makes the search case-sensitive (default is False).
  • --apply-to: Specifies where the renaming should be applied. Options are:
    • name: Rename the file's base name (default).
    • ext: Rename the file's extension.
    • both: Rename both the name and extension.

Tags

  • Text transformations: {string|filter}

    • slugify: Convert into a URL/filename-friendly format (e.g. "hello world" → "hello-world")
    • lower: Convert to lowercase
    • upper: Convert to uppercase
    • caps: Capitalize the first letter
    • title: Capitalize each word
    • camel: Convert to camel case (e.g. "hello world" → "helloWorld")
    • pascal: Convert to pascal case (e.g. "hello world" → "HelloWorld")
    • snake: Convert to snake case (e.g. "hello world" → "hello_world")
    • kebab: Convert to kebab case (e.g. "hello world" → "hello-world")
    • swapcase: Swap the case (e.g. "Hello World" → "hELLO wORLD")
    • reverse: Reverse the string (e.g. "Hello World" → "dlroW olleH")
    • strip: Remove leading and trailing whitespace
    • len: Get the length of the string
  • General

    • Counter: {counter(start=1,step=1,padding=1)}, e.g., {counter(1,2,3)} Insert an incrementing counter. Each placeholder occurrence tracks its own sequence, advancing by step after every file.
  • Date

    • Now: {now(<format>)}, e.g., {now(%Y)} The current date/time.
    • Created At: {created_at(<format>)} The file's creation date/time.
    • Modified At: {modified_at(<format>)} The file's last-modified date/time.
  • File

    • Size: {size(<unit>)}, e.g., {size(mb)} The file's size. Auto-scaled to the largest sensible unit unless a unit (b, kb, mb, gb) is given.
  • Image

    • Width: {width} The image's width in pixels.
    • Height: {height} The image's height in pixels.
    • Taken At: {taken_at(<format>)}, e.g., {taken_at(%Y)} The photo's capture date/time from EXIF metadata. Not available for images without EXIF data (e.g. screenshots, re-exported/edited images).
    • Camera Make: {camera_make} The camera manufacturer from EXIF metadata. Not available for images without EXIF data.
    • Camera Model: {camera_model} The camera model from EXIF metadata. Not available for images without EXIF data.
  • Location

    • Latitude: {latitude} The photo's GPS latitude in decimal degrees. Not available for images without GPS EXIF data.
    • Longitude: {longitude} The photo's GPS longitude in decimal degrees. Not available for images without GPS EXIF data.
    • Altitude: {altitude} The photo's GPS altitude in meters. Not available for images without GPS EXIF data.
  • Video

    • Video Width: {video_width} The video's width in pixels.
    • Video Height: {video_height} The video's height in pixels.
    • Frame Rate: {frame_rate} The video's frame rate. Not available for all containers (e.g. MP4).
    • Duration: {duration} The video's duration, in seconds.

Run renux --help for more details.

Examples

  • Rename files starting with "IMG" to "Image":
    renux my_photos/ IMG_ Image_
    
  • Rename all .txt files to .bak:
    renux my_directory/ .txt .bak --apply-to ext
    
  • Use regex to retain information from the old name:
    renux my_documents "document (\d).pdf" "doc (\1).pdf" -r
    
  • Append a counter to filenames:
    renux my_files/ file "file_{counter}"
    
  • Append creation year to filenames:
    renux my_files/ file "file_{created_at(%Y)}"
    
  • Apply transformations like slugify:
    renux my_files "(.*)" "{filename|slugify}" -r
    

Dev Setup

  1. Clone the repo
    git clone https://github.com/andrianllmm/renux.git
    cd renux
    
  2. Install dependencies with Poetry
    poetry install
    

Testing

Run tests with pytest:

poetry run python -m pytest

Contributing

Contributions are welcome! See CONTRIBUTING.md for more details.

License

Distributed under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

renux-0.3.1.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

renux-0.3.1-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file renux-0.3.1.tar.gz.

File metadata

  • Download URL: renux-0.3.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for renux-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a0df22df76f6fdff5d377d56a744f4f1b4fbf865fbf3d4f6d3e05fe7c8e89477
MD5 31726b129eeb3ec55c90946c29b86d61
BLAKE2b-256 7a1a70be24399edbf0e751c3f5025fd90e3bf087bcb083a10ef9b7bab85003c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for renux-0.3.1.tar.gz:

Publisher: release.yml on andrianllmm/renux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file renux-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: renux-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for renux-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e629a3478a79df91e3cfc389bbcf175075bc061f9e87b7242541a24ba5e12e00
MD5 6c4a6aa89d822f49aea939d99b4c04cc
BLAKE2b-256 52ba82e729674e8ee82f4830cc1eae6be72f6613d26e1a49892bac98c0226395

See more details on using hashes here.

Provenance

The following attestation bundles were made for renux-0.3.1-py3-none-any.whl:

Publisher: release.yml on andrianllmm/renux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.1

2 files

0.4.0

2 files

This release

0.3.1 This release

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page