ExifTool Forum

ExifTool => Newbies => Topic started by: amikot on May 01, 2021, 07:34:34 PM

Title: How to set/modify just part of all the dates according to directory structure?
Post by: amikot on May 01, 2021, 07:34:34 PM
Hi,
I have 20 years of pictures located on my NAS in directory structure like:


Z:\some\path\2001\12\
Z:\some\path\2002\01\
Z:\some\path\2002\02\
...
Z:\some\path\2020\12\
Z:\some\path\2021\01\


I would like to use ExifTool to set year and month as in directory structure, but day and time from actual Exif data.
I'm not good in Regular Expresions, so even if I saw some examples how to pull date from directory name - I could not manage how to fit it to my needs.
That's why I'm here.
Please help :)
Thanks 
Title: Re: How to set/modify just part of all the dates according to directory structure?
Post by: Phil Harvey on May 01, 2021, 09:26:52 PM
So if the Exif contains the time, why not the date?

And what does "set the year and month" mean?  Which year and month?  Assuming the file modify date, maybe this is what you want:

exiftool "-filemodifydate<${directory} ${createdate;s/\d{4}:\d{2}//}" DIR

This should work as long as there aren't numbers is "\some\path\".

- Phil