How to default command line options with .ExifTool_config?

Started by Jan.Steinman, February 20, 2024, 11:56:45 PM

Previous topic - Next topic

Jan.Steinman

I've been through the documents (https://exiftool.org/config.html, https://exiftool.org/ExifTool.html#Options), and I still don't understand how to change command line options via the .ExifTool_config file.

Specifically, I want -ignoreMinorErrors, -overwrite_original_in_place†, -preserve, and -recurse turned on as the default.

Is this possible? Or should I just make a shell alias with those options enabled?

Thanks!

† I use hard links a lot, so I need to make sure that exifTool doesn't break those links.

StarGeek

The options listed under Options can be set as shown at the bottom of the example config file.  As far as I can recall, other command line options don't have a way to set as default, though Phil may correct me on that.

From your list, it looks like only IgnoreMinorErrors can be set by the config file.  You would do so like this

%Image::ExifTool::UserDefined::Options = (
    IgnoreMinorErrors=> 1,
);

Edit: Previous post from Phil, most likely applies to your other options as well
Quote from: Phil Harvey on July 04, 2019, 11:05:16 AMUnfortunately -overwrite_original is an application-level option only.  It doesn't have an equivalent API option that you can set via the config file.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Quote from: StarGeek on February 21, 2024, 01:13:13 AMAs far as I can recall, other command line options don't have a way to set as default

Correct.

But I'll look into adding this capability to the config file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

#3
It turns out that this was easy to implement.  This feature will appear in version 12.78, allowing you to set user-defined command-line arguments like this in the config file:

# Specify default exiftool command-line arguments
# (inserted before all other options except -config)
@Image::ExifTool::UserDefined::Arguments = (
'-echo', '**** Using my default arguments ****',
'-ignoreMinorErrors',
'-overwrite_original_in_place',
'-preserve',
'-recurse',
);

Note that these user-defined arguments will be inserted first on the command line (but after the -config option if used), which means that they will only apply to the first execute'd command if the -execute option is used.  Edit: I thought it made more sense to apply to all execute'd commands, so I have changed it to work this way instead.

Personally, I'm going to use this new feature to ignore files with names starting with ".":

@Image::ExifTool::UserDefined::Arguments = (
'-i', 'HIDDEN',
);

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).