dEEpEst
☣☣ In The Depths ☣☣
Staff member
Administrator
Super Moderator
Hacker
Specter
Crawler
Shadow
- Joined
- Mar 29, 2018
- Messages
- 13,860
- Solutions
- 4
- Reputation
- 27
- Reaction score
- 45,546
- Points
- 1,813
- Credits
- 55,090
7 Years of Service
56%

Want to empty a folder, but keep .zip, .txt or .odt? There are three ways to do this in Linux:

Bash:
shopt -s extglob
rm -v !(*.zip|*.odt)
shopt -u extglob

Bash:
find . -type f -not -name "*.gz" -delete

Bash:
GLOBIGNORE=*.odt:*.txt
rm -v *
unset GLOBIGNORE