Author Topic: Set AllDates on JPGs in multiple subfolder taking date from part of folder name  (Read 499 times)


  • Jr. Member
  • **
  • Posts: 27
Hi all,

I have this situation in a photo/video archive of events: 3,292 folders under the common root with a total of about 44k of JPG photos and MP4 videos. Plenty of photos do not have the Date Taken EXIF properly set, as they are copied from other sources via Web. Some other have Date Taken wrong (e.g. all screenshots of Web articles), referring to the date when the screenshot was made and not to the event date. This, of course, causes problems when searching for dates (I'm using Picasa as photo organizer).

Trying to find the way to use the date string from the folder name to change AllDates on the images, optionally only if they have DateTaken empty or different of the folder name date string, but if not possible, then on all the images and MP4 in the folder, recursively.

An example of the folder name is:

20181202,EX3,Bracciano,VEGAMIAMO VGN060 c,(!),2000000001

The first 8 characters are the date string YYYYMMDD, and that is the date to be supplied to the AllDate option. The time can be changed to 00:00:00, or - if possible - incremented for 1 second on each photo.

So far I've found only the "single folder single image " manual mode, e.g.

e:\exiftool.exe -AllDates="2018:12:02 00:00:00" plch.jpg

If someone knows the way to do it in a batch on all images in all subfolders, it would be very nice to learn how that can be achieved!

Thanks for your help!
Kind regards

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16878
    • ExifTool Home Page
Hi Bruno,

Try this:

exiftool "-alldates<${directory;$_ = /(\d{8})/ ? $1 : undef} 00:00:00" -ext jpg -r DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


  • Jr. Member
  • **
  • Posts: 27

I tested it on a set of few folders, and it looks like it works like a charm!

A genius you are! THANKS!!!!