Rm all files but two

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member MadeInGermany Regarding:
Rm all files but two.
Please Follow The Primary Link Above to View the Full Discussion.

Old 07-12-2017
MadeInGermany MadeInGermany is online now Forum Staff  
I think your pattern is wrong.
Should be
ls -ld /tmp/data/!(output.txt|hello.txt)

If not 100% confident, test with ls -ld first, then run rm -rf.
The Following User Says Thank You to MadeInGermany For This Useful Post:
mohtashims (07-12-2017)