in reply to RE: Re: How can I remove a Dir?
in thread How can I remove a Dir?

In fact, it's rmtree() instead rmpath() (at least in perl 5) 8^)

Jose Quesada

Replies are listed 'Best First'.
Re: Re: RE: Re: How can I remove a Dir?
by softworkz (Monk) on Aug 02, 2001 at 22:19 UTC
    I'm still working with baby perl but this code will display all of the contents of a directory and prompt you with a yes or no to delete the entire directory and it's contents. This code works on perl 5.6.1 on a win32 system. Have fun!
    #!/usr/bin/perl-w use strict; use win32; my $dir = "U:\\foo\\bar\\perl"; system ("dir $dir"); system ("del $dir"); # here the /s includes subtrees and /q supresses the prompt # uncomment this and you won't get the prompt! # system ("del /s /q $dir"); system ("rmdir $dir");