ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: elvis-exif on April 05, 2021, 10:20:22 PM

Title: "-IF" condition not work - resolved
Post by: elvis-exif on April 05, 2021, 10:20:22 PM
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
Title: Re: "-IF" condition not work
Post by: Phil Harvey on April 06, 2021, 07:25:11 AM
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
Title: Re: "-IF" condition not work
Post by: elvis-exif on April 06, 2021, 08:33:42 AM
Thanks -Phil  :)