bash delete everything except

C++
# delete all except the filename

$ rm -v !("filename")
$ rm -v !("filename1"|"filename2") 

Source

Also in C++: