@ChrisDown has given a solution that take into account the difference of files and directories, and also if there is no file to remove.
Given that rm would fail however in these situations, the command could be simplified as
shopt -s extglob nocaseglob
rm !(*.bmp|*.wav|*.png)
Remember to reset the two shell options to their default values. In my case extglob is already set on interactive shells, so I only need
shopt -u nocaseglob
If you would to see in advance what files will be removed, simply substitute the rm with echo.
mvall*.bmp, *.wav, *.pngto newdir. Thenrm -rf dir. – kev Dec 27 '11 at 14:37