I am trying to remove all contents of a directory with some exclusions. I'm currently using this:
find . -type f | grep -vZf ../../exclude.file | xargs rm -rf
*log* world* crash-reports banned-ips*
I don't want to remove the
crash-reports folders or any of their contents (the * is to cover backups, which are generated as
The command above does this, but it does not remove non-empty directories. E.g. the
Config directory is left, but I need it removed.
I've also experimented with similar to the following:
find -maxdepth 0 -not -name '*log*' -not -name 'crash-reports' -not -name 'world*' | xargs rm -rf
But I still get the same result.
Is there a way to do this?