News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

Conditions for -IF ????

Started by Archive, May 12, 2010, 08:54:02 AM

Previous topic - Next topic

Archive

[Originally posted by cemax on 2007-04-04 08:09:39-07]

Could you tell me what are the condition that I can use with -IF (eq, gt, lt.....)https://exiftool.org/forum/Smileys/default/huh.gif" alt="Huh" border="0" />
Can I use something like the "LIKE" statement in SQL? Can I also test conditions in directory and filename?

Thanks in advance.
Max

Archive

[Originally posted by exiftool on 2007-04-04 11:30:17-07]

Any Perl operator may be used.  Here is a description of
http://www.perl.com/doc/manual/html/pod/perlop.html" target="_blank">Perl
operators and their precedence.  Look at the sections on relational
and equality operators.

The most powerful operator for string tests is the binding operator (=~),
which allows you to use the powerful
http://www.perl.com/doc/manual/html/pod/perlre.html" target="_blank">regular
expressions for string tests.  The down side is that regular expressions
are a bit tricky, and can take a while to learn.

You can use any of these tests on the directory ($directory) or filename
($filename) values.

Happy hunting.

- Phil

Archive

[Originally posted by cemax on 2007-04-04 13:56:38-07]

Thanks a lot!

I've read about binding operator... but it's quite difficult https://exiftool.org/forum/Smileys/default/sad.gif" alt="Sad" border="0" />((

could you please post an example of -IF finding all $directory that does not contain "xxx" string?

Thanks in advance!!!! https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />

PS: you did an excellent job! exiftool is the greatest command line utility ever written! https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />))
It can do everithing!

Bye, Max

Archive

[Originally posted by exiftool on 2007-04-04 14:12:27-07]

Hi Max,

Thanks.  Here is that example:

Code:
exiftool -if "$directory !~ /xxx/"  ...

Note I used the "!~" operator here since you want directories that do not contain "xxx".

- Phil

Archive

[Originally posted by gferguson on 2007-04-29 20:57:55-07]

I just started digging into exiftool. I agree, it's way cool. Thank you for all the hard work.

Something I want to do is massage the filename created after a name collision was detected when using the capture date and time.

I want to see resolve filename collisions using A...Z instead of -0..n because the names sort correctly in the Finder and iView or Lightroom.

Can/will the bind operator '=~' support a s/// or is it just m//? Or, is it that the -if test doesn't have the ability to write-back a changed filename?

Or, is there a way to override the filename collision detection so it uses a different format?

Thanks.

Archive

[Originally posted by exiftool on 2007-04-30 11:31:35-07]

Hi,

Exiftool (version 6.81 or later) can already do what you want.
No changes are necessary.  Use "%uc" in the filename format
string for upper case copy letters (A..Z), or "%lc" for lower
case (a..z).

- Phil

Archive

[Originally posted by gferguson on 2007-04-30 16:07:52-07]

"Exiftool (version 6.81 or later) can already do what you want. No changes are necessary. Use "%uc" in the filename format string for upper case copy letters (A..Z), or "%lc" for lower case (a..z)."

Dang. You're good!

And, this after I spent yesterday writing code to do the same thing and applying it to a bunch of old archives.

It's an impressive piece of work, and I'm looking forward to digging into it more. Again, thanks!

Archive

[Originally posted by exiftool on 2007-04-30 16:20:11-07]

[gferguson wrote:]

Code:
"Dang. You're good!"

Thanks,  I try. https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />

- Phil