Hi!
I'm new too ExifTool. I'm trying to set the alldates using the parent directory name but if the directory contains a number it is used to set the hour also. This causes problems when this number is not in a valid hour range.
I've tried to get the substring containing the date only and forcing the hour, but I'm doing something wrong in the expressions:
> exiftool -v5 "-alldates<${directory;$_ = substr($_,0,10)} 12:00:00" -r "../photos/1974-09-02 Photos description 65"
======== ../photos/1974-09-02 Photos description 65/F1000071.JPG
Setting new values from ../photos/1974-09-02 Photos description 65/F1000071.JPG
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in MIE-Doc:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in QuickTime:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in UserData:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in CanonRaw:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Kodak:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Reconyx:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Reconyx:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in Reconyx:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in XMP-exif:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:DateTimeOriginal (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PDF:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in MIE-Doc:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PNG:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PostScript:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in QuickTime:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in XMP-xmp:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:CreateDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PDF:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in MIE-Doc:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PNG:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in PostScript:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in QuickTime:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in XMP-xmp:ModifyDate (PrintConvInv)
Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in IFD0:ModifyDate (PrintConvInv)
Warning: No writable tags set from ../photos/1974-09-02 Photos description 65/F1000071.JPG
Nothing changed in ../photos/1974-09-02 Photos description 65/F1000071.JPG
...
1 directories scanned
0 image files updated
3 image files unchanged
I've also tried the following command with similar output:
> exiftool -v5 "-alldates<${directory;$_=/(\d{4})-(\d{1,2})-(\d{1,2})/} 12:00:00" -r "../photos/1974-09-02 Photos description 65"
And those other commands:
>exiftool -v5 "-alldates<${directory;$_=/(\d{4})-(\d{1,2})-(\d{1,2})} 12:00:00" -r "../photos/1974-09-02 Photos description 65"
======== ../photos/1974-09-02 Photos description 65/F1000071.JPG
Setting new values from ../photos/1974-09-02 Photos description 65/F1000071.JPG
Hour '65' out of range 0..24 in MIE-Doc:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in QuickTime:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in UserData:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in CanonRaw:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Kodak:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in XMP-exif:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in PDF:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PDF:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in IFD0:ModifyDate (PrintConvInv)
Warning: Search pattern not terminated for 'directory' - ../photos/1974-09-02 Photos description 65/F1000071.JPG
Warning: No writable tags set from ../photos/1974-09-02 Photos description 65/F1000071.JPG
Nothing changed in ../photos/1974-09-02 Photos description 65/F1000071.JPG
======== ../photos/1974-09-02 Photos description 65/F1000079.JPG
Setting new values from ../photos/1974-09-02 Photos description 65/F1000079.JPG
Hour '65' out of range 0..24 in MIE-Doc:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in QuickTime:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in UserData:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in CanonRaw:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Kodak:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in XMP-exif:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in PDF:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PDF:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in IFD0:ModifyDate (PrintConvInv)
Warning: Search pattern not terminated for 'directory' - ../photos/1974-09-02 Photos description 65/F1000079.JPG
Warning: No writable tags set from ../photos/1974-09-02 Photos description 65/F1000079.JPG
Nothing changed in ../photos/1974-09-02 Photos description 65/F1000079.JPG
======== ../photos/1974-09-02 Photos description 65/F1000080.JPG
Setting new values from ../photos/1974-09-02 Photos description 65/F1000080.JPG
Hour '65' out of range 0..24 in MIE-Doc:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in QuickTime:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..23 in UserData:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in CanonRaw:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Kodak:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in Reconyx:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in XMP-exif:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:DateTimeOriginal (PrintConvInv)
Hour '65' out of range 0..24 in PDF:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in ExifIFD:CreateDate (PrintConvInv)
Hour '65' out of range 0..24 in PDF:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in MIE-Doc:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PNG:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in PostScript:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in QuickTime:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in XMP-xmp:ModifyDate (PrintConvInv)
Hour '65' out of range 0..24 in IFD0:ModifyDate (PrintConvInv)
Warning: Search pattern not terminated for 'directory' - ../photos/1974-09-02 Photos description 65/F1000080.JPG
Warning: No writable tags set from ../photos/1974-09-02 Photos description 65/F1000080.JPG
Nothing changed in ../photos/1974-09-02 Photos description 65/F1000080.JPG
1 directories scanned
0 image files updated
3 image files unchanged
Can someone give a tip in getting this to work?
Thank you!
Quote from: urbo83 on March 30, 2021, 08:44:06 AM
I've tried to get the substring containing the date only and forcing the hour, but I'm doing something wrong in the expressions:
> exiftool -v5 "-alldates<${directory;$_ = substr($_,0,10)} 12:00:00" -r "../photos/1974-09-02 Photos description 65"
This one fails because you're numbers in the
substr part are off. You're extracting 10 characters (3rd entry) starting at character pos 0 (the first character). So you're extracting
../photos/ from the example, not the date part.
QuoteI've also tried the following command with similar output:
> exiftool -v5 "-alldates<${directory;$_=/(\d{4})-(\d{1,2})-(\d{1,2})/} 12:00:00" -r "../photos/1974-09-02 Photos description 65"
Here, you have the match part right but you're using the equal sign alone, which will assign 1 or 0, depending upon success or failure of the match.
Try
exiftool "-AllDates<${Directory;m/(\d{4}-\d{1,2}-\d{1,2})/;$_=$1} 12:00:00" -r "../photos/1974-09-02 Photos description 65"Here, I just list the regex match operation, which will operate on the default variable
$_. It then captures the date sequence between the parenthesis and stores this result in
$1.
$1 is then assigned to the default variable
$_ which changes the tag value in this instance to the matching date value.
Thank you very much! It works perfectly :)