bengmau has asked for the wisdom of the Perl Monks concerning the following question:

Is there a quick way to delete non-empty directories in perl or do I have to recursively have to delete all the files and then do a recursive unlink of directories by using file::find a couple of times? I could always shell out to do it but that defeats the purpose of platform independence.
  • Comment on simple way to rm -rf non empty directories

Replies are listed 'Best First'.
Re: simple way to rm -rf non empty directories
by japhy (Canon) on Apr 20, 2005 at 15:48 UTC
    Use the standard File::Path module, which provides the rmtree() function.
    _____________________________________________________
    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
Re: simple way to rm -rf non empty directories
by Kevad (Scribe) on Apr 20, 2005 at 15:47 UTC
    Check out File::Path. This provides functionality similar to the unix "rm -r" command.