Last active
January 10, 2024 11:32
-
-
Save star-bits/6bf1b8edf07806f096367886db9ac41d to your computer and use it in GitHub Desktop.
Renames image files by their date taken in YYYYMMDD_hhmmss format followed by the original file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install ExifTool from https://exiftool.org | |
import os | |
import subprocess | |
folder_path = '/Users/username/your/folder' # Replace with your folder path | |
for filename in os.listdir(folder_path): | |
if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.tiff', '.bmp', '.gif', '.mp4')): | |
file_path = os.path.join(folder_path, filename) | |
subprocess.run(['exiftool', '-FileName<${FileModifyDate}_%f.%e', '-d', '%Y%m%d_%H%M%S', file_path]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment