Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

RE: Re: How can I remove a Dir?

by plaid (Chaplain)
on Feb 21, 2000 at 03:36 UTC ( [id://3787]=note: print w/replies, xml ) Need Help??


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

Let's try that again, now that I've actually tried reading something..
use File::Path; my $dir = '/to_remove'; rmpath([$dir], 0, 0);
File::Path comes with the standard distribution

Replies are listed 'Best First'.
Re: RE: Re: How can I remove a Dir?
by Anonymous Monk on Jan 22, 2001 at 11:12 UTC
    In fact, it's rmtree() instead rmpath() (at least in perl 5) 8^)

    Jose Quesada
      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");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://3787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-26 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found