"-IF" condition not work - resolved

Started by elvis-exif, April 05, 2021, 10:20:22 PM

Previous topic - Next topic

elvis-exif

I have some pictures. I want to display certain pictures by -IF condition of the exiftool, but not work.

exif -basename -filename .\Photos -q
Base Name                       : 0008
File Name                       : 0008.JPG
Base Name                       : 0009
File Name                       : 0009.JPG
Base Name                       : 0010
File Name                       : 0010.JPG
Base Name                       : 0011
File Name                       : 0011.JPG
Base Name                       : 0012
File Name                       : 0012.JPG


exif -basename -filename -if "$basename=~/0*(\d+)/ and $1<10" .\Photos -q
Base Name                       : 0008
File Name                       : 0008.JPG
Base Name                       : 0009
File Name                       : 0009.JPG
Base Name                       : 0010
File Name                       : 0010.JPG
Base Name                       : 0011
File Name                       : 0011.JPG
Base Name                       : 0012
File Name                       : 0012.JPG

Phil Harvey

Try this:

exif -basename -filename -if "$basename=~/0*(\d+)/ and $$1<10" .\Photos -q

The "$" must be escaped to prevent exiftool from interpreting it as a tag name.

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

elvis-exif