BASH -- find files with names different than the pattern
If you’re using BASH find and want to find files which are named differently than the given pattern, you can use the following syntax:
find . -type f ! -iname "*.class"
The above command will find all files in the current directory (and subdirectories) which have the extension different (exclamation mark) from “class” (case insensitive).
You can also use conditional operations to build slightly more complicated commands, like:
find . -type f ! \( -iname "*.class" -o -iname "*.jar" \)
The above command uses the OR operation to find all files in the current directory (and subdirectories) which have extension different than “class” or “jar”. Don’t forget about the parentheses escaping!
Didn’t need this feature before today, but I guess it might be quite handy.