For instance, I want to remove all the files in a directory except for the
.tar file from whence they came. I could do something like:
find . -maxdepth 0 | grep -v '.tar$' | xargs rm -f
but is there a way to do is just using rm and shell pattern matching? Feel free to specify it using
bash or other commonly available shells, or with extended options, if it can't be done with vanilla
I found a similar question about avoiding directories and subdirectories with find, but not with shell patterns.