Hello dear Exiftool specialists,
I have tried to find an answer to my question, but unfortunately I can't figure it out :( How can I transfer the metadata and the file name from the folder?
The structure looks like this:
C:\test\
C:\test\1999_10_01 DayOfWeek, Description\
C:\test\1999_10_01 DayOfWeek, Description\MVC-xxxx.jpg
C:\test\1999_10_01 DayOfWeek, Description\MVC-xxxx.jpg
.....
C:\test\1999_10_02 DayOfWeek, Description\
C:\test\1999_10_02 DayOfWeek, Description\MVC-xxxx.jpg
C:\test\1999_10_02 DayOfWeek, Description\MVC-xxxx.jpg
......
C:\test\1999_11_01 DayOfWeek, Description\
C:\test\1999_11_01 DayOfWeek, Description\MVC-xxxx.jpg
C:\test\1999_11_01 DayOfWeek, Description\MVC-xxxx.jpg
.... and so on
The files should be stored with structure Year\Month(Date from Directory name)\<Filename>.jpg and have the date from the directory stored as metadata (Originaldate?).
<Filename> = Date from folder in format YYYYMMDD_OriginalFilename.jpg
Metadata should be set set for OriginaldateTakenPicture and Keyword from Folder Description (Text after Comma)
C:\test\
C:\test\1999\10\
C:\test\1999\10\19991001_MVC-xxxx_Description.jpg
C:\test\1999_10\19991001_MVC-xxxx_Description.jpg
C:\test\1999_10\19991002_MVC-xxxx_Description.jpg
C:\test\1999_10\19991002_MVC-xxxx_Description.jpg
......
C:\test\1999_11\
C:\test\1999_11\19991101_MVC-xxxx_Description.jpg
C:\test\1999_11\19991101_MVC-xxxx_Description.jpg
.... and so on.
Is this this possbile?
Thanks in advance and best greetings from Austria,
Artur
Translated with www.DeepL.com/Translator (free version)
Hi Artur,
This really isn't a newbie-level answer, but...
It sounds like you want something like this:
exiftool -r C:/test "-datetimeoriginal<${directory;s/.*(\d+_\d+_\d+).*/$1 00:00:00/}" "-subject+=${directory;s/.*,\s*//}" "-filename<c:/test2/${directory;$_=/(\d+)_(\d+)_(\d+).*,\s*(.*)/ ? qq($1_$2/$1$2$3_%f_$4.%e) : undef}"
But I haven't tested it. I'm writing the output to a different top-level directory to avoid collisions with existing files. Be sure to test this on dummy files.
Since you are also writing "real" tags, this should make copies of the files and write the new ones to the "test2" output directory. If you get any "_original" files in the source directory, it is because the FileName wasn't written for these.
- Phil
Hi Phil, thanks a lot for your response! I will tried it now and got only new files with original name (MVC-250F.JPG) name and saved files with "_orginal" (MVC-250F.JPG_original) in the source directory. I have to check this tommorrow.
Thanks and many greetings,
Artur
Add the -overwrite_original option (https://exiftool.org/exiftool_pod.html#overwrite_original) to suppress the creation of backup files.