Hi,
If just find is used, the following error will be printed. There are
many ways to solve this problem.
$ mkdir -p {x..z}/0/
$ touch {x..z}/0/1.txt
$ find -name 0 -delete
find: cannot delete ‘./z/0’: Directory not empty
find: cannot delete ‘./x/0’: Directory not empty
find: cannot delete ‘./y/0’: Directory not empty
Assuming no directories to be deleted are in other, I come up with
this. Is this the best way (in terms of
robustness/readability/performance) to solve this problem?
$ find -name 0 -printf '%p\0' | xargs -r -0 rm -rf
--
Regards,
Peng