$ rm !(*.foo|*.bar|*.baz)
Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.
by David Winterbottom (codeinthehole.com)
Related articles by Zemanta
- Visualizing system performance data (amit-agarwal.co.in)
- MoofMenu puts your files in the menu bar (macworld.com)
- ShadyEmail: Mask Your Email to Make it Look Suspicious (domainmacher.com)
- Like it? Tweet it! (emilychang.com)
One thought on “Delete all files in a folder that don\’t match a certain file extension”
You must log in to post a comment.