How to delete all files in a directory except some?
I often face this problem. I have a set of files in a folder and would like to delete all of them except a few.
For example: I have files named according to the date of creation (like 11-1-11.tar, 10-1-11.tar and so on). Now I would like to delete files like 10-1-11, 9-1-11 and so on but not some other files. Basically I would like to enforce what all should be deleted and what should be retained. How would I do this?