Extract recording date from file name

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

Posts: 1
Joined: Thu Dec 22, 2022 2:14 pm

Extract recording date from file name

Post by Horstlein »

Hi Community!

I have a folder with very many photos. For some of them the date of taking is wrong. But the correct date is in the file name.
Is there any way to overwrite the date of taking of very many pictures with the date from the filename?
User avatar
Posts: 1305
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Extract recording date from file name

Post by michel038 »

There is a method, using ExifTool from within XnViewMP.
First step is to create an "Open with ... " entry in Tools menu . You can choose it's name like Name2date
You can see the general method here : viewtopic.php?p=178754#p178754 (If you are using Windows)

And we can try some ExifTool's parameters
If the name of your files contain no other digits than date and time, maybe this one will work
-k -m "-AllDates<Filename"

Select a copy of a file and try : Right-click, Open with Name2date
Exif dates will be updated, but file attributes won't, I think.

You will get a .bak backup of processed files.
If you are sure that the method is OK, you can add -overwrite_original to the exiftool parameters to prevent creation of bak files.

You can also use Exif:CreateDate or Exif:DateTimeOriginal instead of AllDates in the parameter

If it doesn't work or if you encounter error messages, tell us ...
User avatar
Posts: 1661
Joined: Sat May 09, 2015 9:37 am

Re: Extract recording date from file name

Post by user0 »

I would recommend Advanced Renamer, free and powerfull tool with handy UI
that saved me a lot of time in photo-handling tasks (usually just naming into YYMMDD_HHMMSS format).
I also managed to acomplish your usecase there as well.
Gwenael Q.
Posts: 304
Joined: Mon Apr 06, 2020 2:06 am
Location: Martinique

Re: Extract recording date from file name

Post by Gwenael Q. »


That's perfect timing !
I was about to make a request to add this feature as an option available for the "Import and sort" command !

Thanks for listening.