Hello,
I've been using this tool to fix some missing EXIF dates. Most of my files are now complete (thanks!) but I have some annoying files that don't have the date in the name but in the folder:
Folder name: 2018-01-04
inside folder filename: IMG_0108.JPG
Is there a way to use exiftool to use the date from the folder?
exiftool "-datetimeoriginal<foldername" ./ -> I tried this but ofcourse it does not work :).
Thanks!
This should work if the date is the only number in the folder name. First "cd" to the folder containing the date folders, then run this command:
exiftool "-datetimeoriginal<$directory 00:00:00" -if "not $datetimeoriginal" -r .
- Phil
Hey guys, im going through all of my old pictures and im stuck in 2015 with a bunch of pictures which are sorted by date but the exif date is nonexistant on a lot of my pictures. Ive tried the command and it's not working. Should it work through exiftool gui ?
Screenshot 2025-04-21 015529.png
What does "isn't working" mean?
What was your exact command?
What is the exact Directory name? (eg. exiftool -directory FILE)
- Phil
Quote from: jeepaddik on April 21, 2025, 01:57:27 AMIve tried the command and it's not working. Should it work through exiftool gui ?
From the post directly above yours
Quote from: Phil Harvey on September 15, 2023, 02:48:43 PMThis should work if the date is the only number in the folder name.
Your directory has 2015/2015-01-02. In other words, it's trying to set the year to 2015, then the month to 20, and the date to 15. Obviously there's no month 20, so it fails.
In order to split off the last directory name, you would use
${directory;s(.*/)()}I would suggest using
AllDates instead of
DateTimeOriginal, as it will fill two other useful time stamps. You also need to specify that you want only the last
You also don't include
exiftool when using ExiftoolGUI direct.
The result for the tag copy part would be something like this, though I'm not sure about the exact formatting for the GUI
"-AllDates<${directory;s(.*/)()} 00:00:00"