I'm using Linux Mint and have about 2,000 images which have either incorrect or missing EXIF Date tags. I would like to use the date contained in the filename to write the tags. I've spent a few hours trying to figure out how to do this in ExifTool but haven't managed to get very far unfortunately.

The files are in the format: YYYYMMDD_HHMMSS.jpg. However there are some duplicate filenames (different images though, so I can't just delete the duplicates) which are of the format YYYMMDD_HHMMSS(1).jpg. Lastly, there are some images which were shot in burst mode and are of the format YYYYMMDD_HHMMSS_001.jpg.

I'm familiar with the basics of Python so was able to tidy up some other naming issues and get the files to a point where the first 15 characters of every file name adhere to the same format. So I was hoping I could somehow use just the first 15 characters of each file as input to write the tags. I think I need something along the lines of:

exiftool '-AllDates<$Filename...'

...but I cant figure out how to do the advanced formatting which needs to go on the end. Would someone be able to help me out?

I did see this question but it didn't help in my case.


1 Answer 1


You command is mostly correct as written. See Exiftool FAQ #5, 3rd paragraph.

The only suggestion I have is to remove the dollar sign, as it would be unneeded for this operation.

exiftool '-Alldates<Filename' <DirsOrFiles>

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

  • \$\begingroup\$ Thank you! This worked perfectly. I can't believe I missed the FAQs while reading the documentation (fail!). Anyhow, much appreciated. =) \$\endgroup\$ Commented Nov 26, 2017 at 4:32
  • \$\begingroup\$ The documentation is extensive and it's easy to miss something. I knew that line existed someplace but had to search through two other pages before I (re)found it in the FAQ. \$\endgroup\$
    – StarGeek
    Commented Nov 26, 2017 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.