File::Find
use function finddepth to go through directories' contents *before*
looking at the dir itself.
use File::Find
my $wanted = sub {
#skip unless the dir contains '_vti' at the beginning
unless($File::Find::dir =~ /^_vti/) { return }
#if we're looking at a dir, rmdir it
if( -d $_ ) { rmdir $_ }
#otherwise we're looking at a file to delete
else { unlink $_ }
};
finddepth($wanted, $rootdir);
On Thu, 19 Jul 2001, DuBois, Patricia A wrote:
> Okay I really am a newbie. This whole perl thing has confused me. (Any
> suggestions on clarification to my confusion of the language would be
> appreciated as well)
>
> I am trying to create a script on an NT machine that will search through the
> directories and find specific directories/folders and pars through them to
> delete their contents and work it's way back out deleting as it goes. For
> example I want to delete all folders that start with _vti but I can't
> delete this until everything inside is deleted so I have to find this go
> inside delete everything inside and then delete the folder and continue
> doing this through an entire drive.
>
> Is there a module I should be using? Can anyone give me suggestions as to
> where to find info on such a script? I have the Programming Perl book from
> Oreilly but it seems to be giving me info on UNIX and not so much for
> windows.....
>
> Thanks a bunch for your help.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]