Well, if you put . among the directories to exclude, nothing is printed out by the find command. Actually the rm command doesn't work on . and .. since they are a sort of aliases and not the real name of a directory. Anyway, if you want to be sure use -mindepth to exclude the current working directory:
Code:
find . -mindepth 1 -maxdepth 1 -type d
Moreover, in your command line you missed the -0 option of xargs to be used in conjuction with -print0, hence the "a NUL character occurred in the input" warning message. Looking at the complete message from your second command, it shows that it cannot remove directory . but it should have removed the other ones. Anyway, here is a correct command line:
Code:
find . -mindepth 1 -maxdepth 1 -type d \( -wholename ./core -o -wholename ./java \) -prune -o -print0 | xargs -0 rm -rf
or shortly
Code:
find . -mindepth 1 -maxdepth 1 -type d \( -wholename ./core -o -wholename ./java \) -prune -o -exec rm -rf {} \;
Hope this helps.