find . -name "DIR-NAME" -type d -delete
because i want to delete specific dir name recursively well it returns
find: cannot delete `./DIR-NAME': Directory not empty
which is expeted but I have no idea how to make -delete to delete non-empty dirs here as i can with rm -rf
find . -name DIR-NAME -type d -prune -exec rm -rf {} +
– Stéphane Chazelas Mar 15 '23 at 17:38-exec {} +
. I'd say it was about as common in 2014 as now. My point was more about-prune
. Feel free to include my comment on Andy's answer; it looks like his account is not longer active. – Stéphane Chazelas Mar 15 '23 at 17:47{}
arguments, otherwise you have a security issue if someone make a directory with a space it can delete directories outside of the directory and even the root – Tofandel Aug 02 '23 at 20:01