I would like to search for files that would not match 2
-name conditions. I can do it like so :
find /media/d/ -type f -size +50M ! -name "*deb" ! -name "*vmdk"
and this will yield proper result but can I join these 2 condition with OR somehow ?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
yes, you can:
find /media/d/ -type f -size +50M ! \( -name "*deb" -o -name "*vmdk" \)
Explanation from the POSIX spec:
! expression : Negation of a primary; the unary NOT operator.
( expression ): True if expression is true.
expression -o expression: Alternation of primaries; the OR operator. The second expression shall not be evaluated if the first expression is true.
Note that parenthesis, both opening and closing, are prefixed by a backslash (
\) to prevent evaluation by the shell.