A lightweight Windows tool for bulk-renaming files by applying or updating a filename prefix.
Default prefix format:
YYYYMM - Lastname, Firstname - <existing filename remainder>
Repo contents:
doc_prefix_gui.pyw— Tkinter GUI (no third-party dependencies)doc_prefix.py— shared core rename logic + CLI
- Preview-first workflow (nothing changes until Apply)
- Recursive mode (includes subfolders)
- Force mode (re-prefix already-prefixed files)
- Conflict handling: skip / suffix / overwrite
- Editable prefix template in the GUI
Supported placeholders:{yyyymm},{last},{first} - Date modes:
- Current month
- File modified time (mtime)
- Custom YYYYMM
Workflow:
- Select a folder
- Set First/Last and date mode
- Click Preview
- Click Apply (after confirmation)
Requires Python 3.x (Tkinter included with standard Python on Windows).
CLI help:
python doc_prefix.py --help
Run tests:
python -m unittest -v
Packaging smoke test:
python packaging/smoke_test.py
- Preview-first: no changes occur until Apply is pressed.
- Recursive mode does not follow directory symlinks. Symlinked directories are skipped in preview with
skip:symlink-dir.
(This prevents accidental traversal outside the selected folder boundary.) - On Windows, invalid destination basenames are skipped at plan time with a clear reason:
- reserved device names:
CON,PRN,AUX,NUL,COM1-9,LPT1-9(including forms likeCON.txt) - basenames ending in a dot or space
These appear asskip:invalid-destination:<detail>.
- reserved device names:
Preview output includes explicit skip reasons, such as:
skip:already-prefixedskip:conflict-plannedskip:mtime-unavailableskip:symlink-dirskip:invalid-destination:<detail>
- Directory field → positional
dir - First name / Last name →
--first/--last - Recursive →
--recursive - Force →
--force - Conflict dropdown →
--conflict skip|suffix|overwrite - Date mode:
- Current month → default behavior
- Use file mtime →
--use-mtime - Custom YYYYMM →
--date YYYYMM
- Preview button → dry-run preview (no
--apply) - Apply button → executes renames (
--apply) after confirmation
If you are running the GUI from source (not using the packaged exe), you can launch it via a shortcut without opening a console.
Option 1 (recommended): pyw launcher (PEP 397)
- Target example:
pyw -3 "C:\full\path\to\doc_prefix_gui.pyw"
Option 2: direct pythonw.exe path
- Target example:
"C:\Users\<you>\AppData\Local\Programs\Python\Python3x\pythonw.exe" "C:\full\path\to\doc_prefix_gui.pyw"