I want to recursively delete all files in some folders, except for those that have the .gz extension. I usually use
find /thepath -name "foo" -print0 | xargs -0 rm -rf
to recursively delete all folders named "foo" in / path. But now I decided to add an exception. How is this possible?
For example, the folder structure looks like
.hiddenfolder
.hiddenfolder/bin.so
arc.tar.gz
note.txt
sample
So I want to delete everything except arc.tar.gz
source
share