Possible more than one command in if-true?

Started by Roberto, March 01, 2024, 04:21:21 PM

Previous topic - Next topic

Roberto

Hi.

Could not figure out why this (obviously) works:

exiftool -if "not $title" -p "$filename" -execute -if "not $title" "-title<${directory;s/%TEMPLATE%//}" -common_args -overwrite_original -r .

but this - which seems cleaner and more efficient - doesn't:

exiftool -if "not $title" "-title<${directory;s/%TEMPLATE%//}" -p "$filename" -overwrite_original -r .

I am under the understanding that -if should run until either an -execute or "end of command" but it seems only one command is execute (the print never happens in the second command). I just wanted a list of the files updated.

Running on Windows 10, exiftool version 12.74.

Thanks,
/Roberto

Phil Harvey

Hi Roberto,

Extracting tags to console and writing tags are two separate operations in the ExifTool scheme of things.  Read the application documentation down to the 2nd paragraph of the DESCRIPTION.  Also see the schematic here -- blue lines are read mode, and red lines are write mode.

- 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 ($).

StarGeek

Quote from: Roberto on March 01, 2024, 04:21:21 PMI just wanted a list of the files updated.

Take a look at the -progress option.

Example, Test-2.jpg already has a title and is skipped
C:\>exiftool -P -overwrite_original -progress -if "not $Title" "-Title<Filename" Y:\!temp\x\y\z
======== Y:/!temp/x/y/z/test-1.jpg [1/3]
======== Y:/!temp/x/y/z/test-3.jpg [3/3]
    1 directories scanned
    1 files failed condition
    2 image files updated
"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 March 01, 2024, 11:54:36 PM
Quote from: Roberto on March 01, 2024, 04:21:21 PMI just wanted a list of the files updated.

I missed that.  The -efile8 option outputs a list of updated files:

exiftool -efile8 file_list.txt ...

- 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 ($).

Roberto