user3706789
user3706789

Reputation: 97

Deleting particular named directories from parent and all child folders

My folder hierarchy is like A/B/C/D.

So now each folder contains directory named CVS.

My purpose is I want to delete all CVS named directories from all folders.

I frequently tried to execute from parent folder(A Folder) rm -rf "CVS" , but it deletes CVS folder only from A folder and it's not fulfilling my needs.

I want to delete total 1200 folders named CVS.

If you can let me know appropriate command to delete CVS named directory recursively from parent to all sub folder it would be great help.

Upvotes: 2

Views: 212

Answers (1)

Karthikeyan.R.S
Karthikeyan.R.S

Reputation: 4041

You can use the find command.

find pathname -type d -iname "CVS" -delete

In path name , You can give the path from which directory you have to delete.

Or else try this.

 find pathname -type d -iname "CVS" -exec rm -rf \{\} \;

Upvotes: 2

Related Questions