How to set/modify just part of all the dates according to directory structure?

Started by amikot, May 01, 2021, 07:34:34 PM

Previous topic - Next topic

amikot

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 

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).