find . -type f -not -name '*.mp3'
Find is normally used to positively match a pattern, for example this finds all regular files (-type f
) whose name ends with ".mp3" (-name '*.mp3'
):
find . -type f -name '*.mp3'
If you want to use a condition in the inverted sense, for example to find files whose name does not end with ".mp3", then you can invert the condition by using -not
predicate in front of it, as in the main one-liner above.