Hi!
since I´d like to use exiftool from a PowerShell script in order to get EXIF info for photo and video files, I need to know what return codes can be expected.
To keep things "simple", I´d like to "walk" recursively (in PowerShell) through a directory which contains a lot of different files and filetypes as well.
Then I have 2 possibilities:
- in PowerShell filter out all files that are not photo or video and can have EXIF info and then invoke exiftool for all other files
- or ask exiftool to retrieve exif data from EVERY file, in which case I need to have a return code for when a file has no valied EXIF data
What is the beszt way?
Thx very much!
From the docs on Exit Status (https://exiftool.org/exiftool_pod.html#EXIT-STATUS)
QuoteThe exiftool application exits with a status of 0 on success, or 1 if an error occurred, or 2 if all files failed the -if condition (for any of the commands if -execute was used).
Also, if you are working with a large number of files, then calling exiftool once per file will significantly increase processing time (see Common Mistake #3 (https://exiftool.org/mistakes.html#M3)). Exiftool's startup time is it's biggest performance hit. If at all possible, it's best to give exiftool all the files/directories to process and then parse the output data.
Or you could look into the
-stay_open option (https://exiftool.org/exiftool_pod.html#stay_open-FLAG), which keeps exiftool running in the background, allowing for interactive processing.
While it might be less of a problem for you if you're more familiar with Powershell, PS doesn't like the formatting of some standard exiftool commands. This post (https://exiftool.org/forum/index.php?topic=14962.msg80581#msg80581) shows a common type of exiftool command and shows quoting that works with Mac/Linux and with CMD, but neither work with PS. I've long since given up trying to figure out PS's idiosyncrasies compared to standard command lines.
I really didn´t ponder "exit codes" instead of "return codes". My bad.
Will definitely use your suggestions ;D
Thx a lot!