linux bash remove all files except code example
Example 1: delete all the files without one in linux
# delete all except the filename
$ rm -v !("filename")
Example 2: bash delete everything except
$ rm -v !("filename1"|"filename2")
# delete all except the filename
$ rm -v !("filename")
$ rm -v !("filename1"|"filename2")