Home: Perl Programming Help: Win32 Programming Help:
delete specific sub directories recurcively

New User

Feb 12, 2013, 12:51 AM

Views: 24464
delete specific sub directories recurcively


I have written a perl script to checkout from CVS. I want to recurcively delete all the 'CVS' directories from every folder. How can I do that. Thanks in advance.

Raju babannavar

Veteran / Moderator

Feb 12, 2013, 6:18 AM

Views: 24461
Re: [Raju.b] delete specific sub directories recurcively

Use the File::Find (or File::Find::Rule) module to traverse the directory tree deleting the directories as needed. You'll want to set no_chdir to true so that you can delete the current dir if needed.


You'll also want to use the File::Path module to handle the deletion process.


(This post was edited by FishMonger on Feb 12, 2013, 6:20 AM)