The folder structure is as below
A/B/C1/
A/B/C2/
X/B/C1/
X/B/C2/
I want to delete all C2 folders however keep C1 intact.
What is the correct command for that?
This works just fine: rm -rf */*/C2/
Please be careful, because it says nothing when deleteing all the files and folders recersively. If you want to be cautious, you can use: rm -ri */*/C1/
instead which prompts for every deletion.
rm -rf */*/C2/
because I want to delete C2
I think the safest method would be like this:
find . -maxdepth 3 -name C2 -type d -exec rm -fr '{}' ';'