Renaming files based on EXIF data—especially photos—is a common task for organizing images by the date and time they were taken. Here’s a Python script that uses the Pillow and os libraries to rename image files in a folder based on their EXIF metadata (e.g., YYYY-MM-DD_HH-MM-SS.jpg).
🐍 Python Script: Rename Files Using EXIF Metadata
📌 Notes:
-
Only processes
.jpgand.jpegfiles. -
Skips files without
DateTimeOriginalEXIF tag. -
Prevents overwriting by appending a counter if a filename already exists.
Let me know if you want this adapted for other EXIF tags (like camera model) or file types (like .png, though they rarely have EXIF).
Share this Page your favorite way: Click any app below to share.