This Python script renames image files in the specified folder in two steps:
- Assign a unique temporary name using UUID to avoid filename conflicts.
- Rename files in order of creation time following the format:
WF-YYYY-MM-DD_(PXX).ext
.
- Supports common image formats:
.jpg
,.jpeg
,.png
,.gif
,.bmp
,.tiff
,.webp
,.mov
. - Sorts images by their creation time.
- Allows the user to specify a starting number for indexing.
- Ensures filenames remain unique during processing.
- Python 3.x
- Place the script inside the target folder where the images are stored.
- Run the script:
python script.py
- Enter the starting number when prompted (or use the default value
1
if input is invalid). - The script will rename images following the pattern
WF-YYYY-MM-DD_(PXX).ext
.
Before execution:
photo1.jpg
photo2.png
photo3.gif
After execution (assuming today's date is 2025-02-03 and starting number is 1):
WF-2025-02-03_(P01).jpg
WF-2025-02-03_(P02).png
WF-2025-02-03_(P03).gif
- The script operates on files in the current directory (
./
). - It first assigns temporary names before renaming them to avoid conflicts.
- Sorting is based on the file creation time.
This script is free to use and modify for any personal or commercial projects.