hello,
I'm trying to test if datetimeoriginal exists in a file.
probleme is, when it exists, i have a return "xx:xx:xx unknown operand" and when the date doesnt exist, I have "- unknown operand".
this is whath I was thinking of:
if [ -z $(exiftool -f -s3 -"DateTimeOriginal" -Pv "$line") ]
then
echo "no date"
else
echo "date"
fi
any ideas?
Try this:
#!/bin/sh
if [ "$(./exiftool -f -s3 -"DateTimeOriginal" "a.jpg")" == "-" ]
then
echo "no date"
else
echo "date"
fi
Also, I'm not sure what you were trying to do with the -Pv, but it wasn't doing what you wanted.
- Phil
yeah ! so happy, thanks !
it worked with
if [ "$(exiftool -f -s3 -"DateTimeOriginal" "$line")" == "-" ]
it's to make a check on a file in case it has no datetime so I can get the folder name and rename the file.
thanks again
Right. Sorry, I forgot to remove the "./" and change "a.jpg" back to "$line". (I usually run tests like this using a local copy of exiftool on a test file called "a.jpg".)
- Phil
Could this be achieved at the command line?
Perhaps passing a directory into %1 then ignoring any files with valid DateTimeOriginal & displaying Directory-Filename only for invalid.
this fails
exiftool %1 if [ -f -s3 -"DateTimeOriginal" "$line" == "-" ] then echo "$directory-$filename"
On the command line:
exiftool -directory -filename -T -if "not $datetimeoriginal" -r DIR
- Phil
thanks Phil
How can I contribute towards the costs of keeping this amazing service of yours going?
Thanks for the offer. There is a "Donate" button on the ExifTool home page (https://exiftool.org/index.html#donate) just for this purpose. :)
- Phil
So there is!
(and it works too)
I got the donation. Thank you very much!!
- Phil