You have the syntax wrong. You want all the -name
options in the same parentheses, and a space around the parentheses, like this:
find ./Music -type f \( -name '*.mp3' -or -name '*.wav' -or -name '*.flac' -or -name '*.ogg' \) -delete
Your original command was using -name \('*.mp3' -or -name '*.wav' -or -name '*.flac' -or -name '*.ogg'\)
which means it was looking for files named \(*.mp3
, or '*.wav'
or '*.flac'
or '*.ogg'\)
. You can see this if you run the command without the -delete
option:
$ find ./Music -type f -name \('*.mp3' -or -name '*.wav' -or -name '*.flac' -or -name '*.ogg'\)
./Music/3.wav
./Music/2.flac
Since there are no matches for \('*.mp3'
or *.ogg\)
, those files were not found. And since you hadn't grouped the command in parentheses (you need spaces around the parentheses for that to work), the -delete
wasn't applied as you expected (sorry, I don't know exactly how find
would have parsed that).