exclude specific folder on remove linux code example
Example 1: how to remove all files except one in linux
# if you are using a loop
shopt -s extglob
rm -rf !("abc.txt" | "abc.log" ) # others will be removed except these two
shopt -u extglob
Example 2: ubuntu remove all except
$ rm -v !("filename")