Page 1 of 1

How to run ExifTool script on the current directory?

Posted: 16 Mar 2021 08:03
by wwcanoer
How to run a single line ExifTool script on the current directory?

For testing, I tried to display:
exiftool -if $DateTimeOriginal -DateTimeOriginal *.*

My actual command is: [to create the date from a filename ex. IMG-20190509-WA0009.jpg (but breaks over WA0060) ]
exiftool -P -overwrite_original "-datetimeoriginal<filename" *.*

They work in the address line by prefixing with ! but I would prefer a script assigned to a keypress as I will create more than one script.

I tried run "exiftool.exe ...." but no matter where I try adding quotation marks in singles, pairs or triplets there is always a "Dubious Syntax" error.
Adding the path to exiftool.exe didn't help.

Do I need to call the command/terminal window first? (I tried following another example but that failed as well.)

Can use the <curpath>? ex. exiftool -P -overwrite_original "-datetimeoriginal<filename" <curpath>

Re: How to run ExifTool script on the current directory?

Posted: 16 Mar 2021 08:36
by highend
You can't execute commands directly in a script.

You need to use e.g. run or runret()

Like:

Code: Select all

    $result = runret("""exiftool"" -P -overwrite_original ""-datetimeoriginal<filename"" *.*");
    text $result;

Re: How to run ExifTool script on the current directory?

Posted: 16 Mar 2021 18:31
by wwcanoer
That works. Thank you for the prompt reply!

My notes:

Works but the cmd window opens and automatically closes when done:

Code: Select all

run """exiftool""  -time:all -g1 -a -s *.mp4"  
The results open in a persistent window:

Code: Select all

$result = runret("""exiftool""  -time:all -g1 -a -s *.mp4");
text $result;