Day 13 of 100 Days Coding Challenge: Python
Have you ever dumped a bunch of photos from your phone or camera onto your computer, only to be greeted by a wall of files named IMG_2034 or DSC_0198? That was me last week. We’d just come back from visiting my dad in Indiana, and I spent hours renaming photos just so I’d know what was what later. By hour three, I started questioning my life choices.
Today’s app was born out of that chaos. It’s for anyone who’s ever opened their Downloads folder and felt genuine fear. You know the scene—screenshot(385).png, resume_final_final_really_FINAL.docx, and misc.zip (which, let’s be honest, contains nothing but regret).
Eventually, I snapped. I built a File Renamer. Because at some point, every coder realizes the real enemy isn’t broken code—it’s bad file names. My little app brought order to the madness, one underscore at a time. Justice was served. Silently.
Today’s Motivation / Challenge
File naming seems trivial—until it isn’t. Whether it’s organizing screenshots, exported reports, or the fifth version of your side project’s logo, we’ve all played the “rename, regret, repeat” game. This challenge gave me a chance to bring order to chaos, while flexing my Python skills in a way that solves a real, everyday annoyance. Plus, there’s something oddly satisfying about watching a folder transform from digital dumpster to methodical masterpiece.
Purpose of the Code (Object)
This Python app batch-renames files in a folder using a pattern you choose—like photo_1.jpg, photo_2.jpg, and so on. It lets you preview changes, filter by file type, and confirm before anything happens. The final version even adds an undo option and keeps a time-stamped log of renamed files.
AI Prompt:
“Please create a Python code File renamer.”
“Can you add the following function to the GUI version? #Add an undo feature #Add a log file to save old/new names.”
Functions & Features
- Select a folder with a file dialog (no more mistyped paths)
- Set custom prefix and starting number
- Filter files by extension (e.g., .txt, .jpg)
- Preview all renaming before it happens
- Automatically log all rename operations with a timestamp
- Undo your most recent renaming session
Requirements / Setup
- Python 3.6+
- No extra libraries needed (just tkinter, which comes with Python)
Minimal Code Sample
for i, file in enumerate(files, start=start_number):
ext = os.path.splitext(file)[1]
new_name = f”{prefix}{i}{ext}”
os.rename(os.path.join(folder_path, file), os.path.join(folder_path, new_name))
This is where the magic happens: renaming each file while keeping its original extension.
Notes / Lessons Learned
So all your files become lovely, logical things like file_1.txt, file_2.txt, and file_3.txt. It was beautiful. It was organized. It was… terrifyingly powerful. That’s when I remembered something crucial: I never get folder paths right. Backslashes, forward slashes, hidden Unicode weirdness—my fingers always betray me.
So I thought, “Let’s make this a GUI.” Because honestly, why should I suffer when I can just click a folder like a functioning adult?
New version, new vibe. It had buttons. It had folder selection dialogs. It even had a preview feature, like the app was politely saying, “Here’s what you’re about to do. You sure about this?” If there were no files to rename, it didn’t throw a tantrum—it simply shrugged and bowed out.
And just when I thought it was “done,” I asked myself:
What if I mess this up?
Enter: undo button and activity log.
Because if we’re going full Renamer Pro Mode™, I want receipts. I added:
- A complete log of what each file used to be called
- A timestamp of when the operation occurred
- An undo feature, because I’m not about to manually rename everything back like it’s 2003
Once I tested everything (successfully, I might add—zero casualties), I realized something strange and wonderful:
This tiny project gave me an idea for improving a workflow at my day job. Turns out, renaming a bunch of files can actually inspire how to batch-handle documents in Power Automate. Who knew?
Oh, and one last grown-up move: I finally added a license to the project.
Here’s what I learned:
A License Type
- MIT: Super chill. Basically says, “Take it, use it, remix it—just don’t sue me.”
- GPL: More of a Robin Hood. If you improve it, you share it.
- Apache 2.0: Like MIT but with a legal helmet.
- No License: Says, “I’m not ready for commitment.” Basically off-limits.
I went to MIT because this little renamer deserves to be free.
Optional Ideas for Expansion
- Add a “dry run” mode to simulate renaming without touching files
- Add support for multiple undo steps (not just one session)
- Export the log as a CSV file for spreadsheet nerds (no judgment)

