A lightweight Windows utility to rename and safely delete files with excessively long names that cause OS errors.
Repository Summary (One-liner)
A lightweight Windows utility to rename and safely delete files with excessively long names that cause OS errors.
README Description
When downloading files through web browsers, Windows users frequently encounter an issue where files with exceptionally long filenames cannot be deleted, moved, or renamed natively through File Explorer. This happens because Windows traditionally struggles with file paths that exceed the 260-character limit (known as MAX_PATH).
This utility solves that frustration. By bypassing standard File Explorer restrictions, the program allows you to quickly rename these problematic, large-named files down to a short string, enabling Windows to instantly and safely delete them thereafter.
- Bypass Windows Restrictions: Easily handle files blocked by traditional path-length limitations.
- Streamlined Workflow: Rename and delete stubborn files directly inside the application interface.
- Safe Clean-up: Perfect for cleaning up messy browser downloads without needing to mess with the Windows Registry or complex command-line tools.
Usage
If you have Python installed, run the app directly from the repo:
python filerenamer.pyThen:
- Click "Select Files" to choose one or more files, or use "Add Path" to paste/open a single file path.
- Select an entry, type a new name in the box, choose whether to keep the original extension, then click "Apply Rename".
- To remove a stubborn file, select it and click "Delete Selected".
If you distribute the built dist\FileRenamer.exe, users do not need Python installed on their machine. The EXE includes the runtime dependencies needed to run the app.
New features
- Modernized GUI using
ttkcontrols and a file list with name-length display. - After renaming, if the new name (excluding extension) is under 25 characters the app can optionally prompt to delete the file (defaults to prompting). Deletions go to the Recycle Bin by default.
Build an EXE
You can bundle this into a single Windows executable using pyinstaller.
- Install build deps:
pip install -r requirements.txt- Run the helper batch (Windows):
.\build_exe.batThe built FileRenamer.exe will be inside the dist folder.
The standalone EXE can be copied to another Windows machine and run without installing Python.
Notes
- This tool uses the Windows API (
MoveFileW/DeleteFileW) viactypesto support extended-length paths (the\\?\prefix). - No extra packages required; uses the standard library's
tkinterfor the GUI. If your Python doesn't includetkinter, install the appropriate package for your distribution. - Run as a user with permissions to modify the target files.
If you want this packaged into a single executable for distribution, I can add a pyinstaller spec.