Hi,
I want to set the datetimeoriginal based on the directory, if the datetimeoriginal is empty. I tried some things, but it does not work.
Do you have any idea?
An example for a directory is:
/volume1/photos/2001/01.01.2001/
I tried the following command:
exiftool "-datetimeoriginal<${directory;.*(\d{2}\.\d{2}\.\d{4}).*//} 00:00:00.000" -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' /volume1/photos/2001/01.01.2001/
It's unclear whether your format is MM.DD.YYYY as in the U.S. or DD.MM.YYYY as used elsewhere.
Try this for the directory entry if the first, otherwise swap $1 and $2
${directory;m/(\d{2})\.(\d{2})\.(\d{4})/;$_=$3$1$2}
Thanks!
After executing your command the command line shows the following error:
-sh: -datetimeoriginal<${directory;m/(\d{2})\.(\d{2})\.(\d{4})/;$_=$3$2$1} 00:00:00.000: bad substitution
What am I doing wrong?
My new command looks like this:
exiftool "-datetimeoriginal<${directory;m/(\d{2})\.(\d{2})\.(\d{4})/;$_=$3$2$1} 00:00:00.000" -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' /volume1/photo/2005/03\ -\ März\ 2005/25.03.2005/
Try this:
exiftool '-datetimeoriginal<${directory;m/(\d{2})\.(\d{2})\.(\d{4})/;$_="$3$2$1"} 00:00:00.000' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' /volume1/photos/2001/01.01.2001/
- Phil
That worked! Thank you!
Is it possible to use the date from the filename and the time from the fileCreatedDate instead of 00:00:00.000?
Quote from: stefanjoa on May 22, 2020, 03:58:30 AM
What am I doing wrong?
You didn't mention you were not on Windows ;) (just teasing)
Quote from: stefanjoa on May 22, 2020, 06:18:37 AMIs it possible to use the date from the filename and the time from the fileCreatedDate instead of 00:00:00.000?
Replace
00:00:00 with
${FileCreateDate;DateFmt("%H:%M:%S")}