How can I delete content of all directories with a certain name?
I have a directory structure with many build
directories inside. I want remove their content (all files and sub-directories), but leave the directory itself (so there will be empty build
directory).
I was trying adapt solution proposed in this question: How to remove folders with a certain name however after executing this command:
find . -name "build" -type d -exec rm -r "{}/*" \;
I got a responses (for each found match)
rm: cannot remove './path/to/found/build/*': No such file or directory
When I call directly
rm -r ./path/to/found/build/*
All files inside are removed (as expected)