Say you wanted to delete all files in the current directory except README.txt. You could accomplish this by using find:

1
$ find . -type f ! -name 'README.txt' -delete

Similarly to delete everything but a certain extension:

1
$ find . -type f ! -name '*.tmp' -delete

Peace!!