Skip to content

Sparky2273/ReplaceCharacter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✏️ ReplaceCharacter

A free, open-source batch file-rename suite with a clean GUI β€” replace, remove, or transform characters and words in hundreds of filenames at once, with live preview, undo/redo, and regex support.

Version Python Platform License PyQt6 Regex Undo/Redo Single File

⚑ Quick Start (EXE) · Features · Run from Source · How to Use · Regex Examples · Undo / Redo · Troubleshooting


πŸ“– Table of Contents


πŸ” What Is This?

ReplaceCharacter is a desktop application that renames files in bulk by finding and replacing β€” or completely removing β€” characters, words, and patterns from filenames. Instead of renaming files one by one, you load a folder, set your rules, preview the result, and apply everything in one click.

Who is this for?

  • Anyone who has downloaded files with ugly naming patterns (e.g., spaces replaced by underscores, numbers prefixed, dates in the wrong format)
  • Photographers, video editors, and musicians managing large media libraries
  • Developers cleaning up generated or downloaded file sets
  • Anyone who has ever needed to rename dozens or hundreds of files at once

Everything runs 100% locally and offline β€” no internet, no server, no data sent anywhere.


✨ Features

Feature Description
πŸ”„ Replace Mode Find any character, word, or pattern in filenames and replace it with something else
πŸ—‘οΈ Remove Mode Remove any word or substring from filenames entirely (replacement = nothing)
πŸ” Regex Support Use full Python regular expressions instead of plain text for advanced pattern matching
πŸ”‘ Case-Insensitive Option Match patterns regardless of uppercase or lowercase
πŸ‘οΈ Live Preview See exactly what every filename will become before applying any changes β€” in a clear before/after table
↩️ Undo / Redo Instantly reverse or reapply any batch rename operation, with timestamps on each action
πŸ“‚ Folder Processing Load an entire folder and rename all files inside it in one operation
πŸ“„ Individual File Mode Select and rename specific files only
πŸ–±οΈ Drag & Drop Drag a file or folder directly onto the window to load it instantly
πŸ“Š Batch Progress Bar Live progress bar with filename display during large batch operations
⏱️ Activity Indicator Real-time status: "Processing…", "Undoing…", "Redoing…"
🧡 Non-Blocking UI All renaming runs in a background QThread β€” the window stays responsive on large folders
πŸ“‹ Operation Log Panel Color-coded timestamped log of every rename: βœ” success, ✘ error, β€” no change
πŸ“ Optional File Logging Write the full log to replace_character.log for an audit trail
πŸ’Ύ Saves Preferences Remembers your last settings (theme, regex toggle, case sensitivity, directory) between sessions
🎨 Light / Dark Theme One-click toggle between light and dark themes
πŸ“¦ Single File Entire app in one Python file β€” easy to audit, share, and run

⚑ Quick Start (Windows EXE)

No Python needed.

  1. Go to the Releases page of this repository.
  2. Download ReplaceCharacter.exe.
  3. Double-click it β€” the app opens immediately. No installation required.
  4. Load a file or folder, set your replace rules, check the Preview tab, then click ⚑ Apply Changes.

Fully portable β€” run it from any folder or USB drive.


🐍 Run from Source

Requirements

  • Python 3.8 or newer β€” https://www.python.org/downloads/
    • Windows: tick βœ… "Add Python to PATH" during installation
  • PyQt6 (the only non-standard dependency β€” everything else is Python stdlib)

Step 1 β€” Get the Script

Download ReplaceCharacter_V1.py from this repository, or clone:

git clone https://github.com/Sparky2273/ReplaceCharacter.git
cd ReplaceCharacter

Step 2 β€” Install Dependencies

pip install -r requirements.txt

Step 3 β€” Run

python ReplaceCharacter_V1.py

πŸ“– How to Use

Replace Characters

This mode finds every occurrence of a character or word in a filename (excluding the extension) and replaces it with something new.

  1. Click Select File or Select Folder β€” or drag and drop a file/folder onto the window.
  2. In the Replace section, tick the Enable Replace checkbox.
  3. In the Find box, type the character or word you want to replace (e.g., a space , an underscore _, or a word like copy).
  4. In the Replace with box, type what you want instead (e.g., -). Leave it empty to delete the matched text.
  5. Optionally enable Regex or Case-Insensitive (see below).
  6. Click the Preview tab to see the before/after table β€” verify nothing unexpected will change.
  7. Click ⚑ Apply Changes.

Example: Replace all spaces with underscores in a folder of music files:

  • Find: (space)
  • Replace with: _
  • Result: My Song Name.mp3 β†’ My_Song_Name.mp3

Remove Words

This mode removes a specific word or substring from every filename β€” no replacement, just deletion.

  1. Load your file or folder (same as above).
  2. In the Remove section, tick the Enable Remove checkbox.
  3. Type the word or text to remove (e.g., - Copy, (1), final_).
  4. Preview β†’ Apply.

Example: Remove - Copy from filenames after duplicating:

  • Remove: - Copy
  • Result: Report - Copy.docx β†’ Report.docx

Tip: You can use both Replace and Remove at the same time β€” the replace step runs first, then the remove step is applied to the result.


Live Preview

Before applying any change, always check the Preview tab:

  • Click the Preview tab (next to the Log tab).
  • Click πŸ” Generate Preview to build the before/after table.
  • The table shows three columns: Original Name, New Name, and Changed (βœ” if the name will change, β€” if it stays the same).
  • Files with no change are shown with a dimmed "β€”" marker β€” only files that actually change are renamed.
  • If everything looks correct, switch back to the main tab and click ⚑ Apply Changes.

Processing a Folder

  • Click Select Folder and choose a directory.
  • ReplaceCharacter processes every file directly inside that folder (not subfolders β€” one level deep).
  • Subfolders themselves are not renamed β€” only the files within them.
  • The progress bar shows current / total and the filename being processed.

πŸ” Regex Support

Enable the Use Regex checkbox to treat the Find field as a Python regular expression instead of plain text. This gives you powerful pattern-based matching.

Regex Examples

Goal Find (Regex) Replace with Example
Remove leading digits and a dot ^\d+\. (empty) 01. Song Name.mp3 β†’ Song Name.mp3
Replace multiple spaces with one \s+ My File Name.txt β†’ My File Name.txt
Remove anything in parentheses \s*\([^)]*\) (empty) Report (v2) Final.docx β†’ Report Final.docx
Remove trailing spaces or dashes [\s\-]+$ (empty) My File - .txt β†’ My File.txt
Replace underscores or hyphens [_\-] my_file-name.txt β†’ my file name.txt
Remove date pattern YYYY-MM-DD \d{4}-\d{2}-\d{2} (empty) photo_2024-03-15.jpg β†’ photo_.jpg
Remove bracketed numbers [1] \s*\[\d+\] (empty) Track [1].mp3 β†’ Track.mp3

Important: The extension (.mp3, .txt, .docx, etc.) is never changed β€” the regex is applied only to the filename stem (the part before the last dot). You cannot accidentally remove a file extension.

Regex Tips

  • Enable Case-Insensitive together with regex to match regardless of letter case.
  • If your regex is invalid, the Preview step will show an error in the log and no changes will be applied.
  • Test complex patterns in the Preview tab before applying.

↩️ Undo / Redo

Every batch rename operation is recorded and can be fully reversed.

  • Undo (↩) β€” reverses the most recent rename batch, restoring all filenames to what they were before.
  • Redo (β†ͺ) β€” reapplies a rename batch that was undone.
  • The Undo and Redo buttons show a label with the number of files and timestamp of the operation (e.g., ↩ Undo (12 rename(s) @ 14:35:02)).
  • Multiple operations are stacked β€” you can undo several operations in sequence.
  • Undo also available from the Edit menu in the menu bar (Ctrl+Z / Ctrl+Y).

Note: Undo only works while the app is open in the same session. Undo history is not saved to disk and is lost when the app is closed.


βš™οΈ Options Reference

Option Description
Enable Replace Activates the Find β†’ Replace with step
Find The character, word, or regex pattern to search for in filenames
Replace with What to substitute for each match (leave empty to delete matches)
Enable Remove Activates the Remove word step
Remove word The exact substring to delete from every filename
Use Regex Treats the Find field as a Python regex pattern
Case-Insensitive Matches regardless of uppercase/lowercase for both Replace and Remove
Enable File Logging Writes all log entries to replace_character.log with timestamps

πŸ“ File Logging

  • Enable with the Enable Logging checkbox.
  • Logs are written to replace_character.log in the same folder as the app.
  • Each entry: YYYY-MM-DD HH:MM:SS [LEVEL] Message
  • Useful for auditing what was renamed on a specific date.
  • File logging is off by default.

πŸ’Ύ Saved Preferences

The app saves your settings to replace_character_config.json in the same folder, and restores them next time you open the app. Settings saved:

Setting What is remembered
theme Light or dark theme
use_regex Whether regex mode was on
case_sensitive Whether case-sensitive matching was on
enable_logging Whether file logging was enabled
last_directory The last folder you opened
old_char The last value in the Find field
new_char The last value in the Replace with field
remove_word The last value in the Remove word field

Delete replace_character_config.json to reset all preferences to defaults.


πŸ”§ Troubleshooting

"No module named PyQt6" β†’ Run pip install -r requirements.txt and try again.

Files were renamed but I want the original names back β†’ Click the ↩ Undo button immediately β€” it will restore all filenames from the last operation.

Undo button is greyed out β†’ The undo history is only kept in the current session. If you closed and reopened the app, the history is gone. You can manually redo the rename in the opposite direction (swap Find/Replace).

Regex error in the log β†’ Your regular expression has a syntax error. Check the Pattern in the Find field β€” the log panel will show the exact error message. Fix the pattern and try Preview again.

Some files say "no change" in the log β†’ The pattern did not match those filenames. This is normal β€” they are skipped safely.

"Permission denied" error for some files β†’ The file may be open in another application, or you may not have write access to that folder. Close apps that have the files open and try again.

The app renamed more files than expected β†’ Check the Preview before applying next time. Use the case-sensitive option or a more specific pattern to narrow the match.


❓ FAQ

Q: Does this change file extensions? A: No. The extension (e.g., .mp3, .jpg, .docx) is always preserved. Only the filename stem (the name before the last dot) is changed.

Q: Can it process subfolders recursively? A: In v1.0.0, processing is one level deep (files directly inside the selected folder). Recursive subfolder support may be added in a future version.

Q: What happens if two files would end up with the same name after renaming? A: The second file's rename will fail with a "file already exists" error, which is shown in the log. The first file is renamed successfully. Use the Preview tab to spot collisions before applying.

Q: Can I use both Replace and Remove at the same time? A: Yes. Enable both checkboxes. The replace step runs first, then the remove step is applied to the result.

Q: Is this safe for system files or important files? A: Only use it on files in folders you own and manage. The undo feature can reverse mistakes within the same session. For very important files, always work on a copy first.

Q: Does the app send any data over the internet? A: No. ReplaceCharacter is 100% offline.


πŸ“¬ Contact & Support


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


Made with ❀️ by SPARKS

Rename smarter, not harder.

About

Batch file-rename tool with GUI. Replace or remove characters, words, and regex patterns in hundreds of filenames at once. Live preview, undo/redo, drag-and-drop. PyQt6. Windows EXE available.

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages