in reply to Oops I did it again.....

For a far more Perly experience, see rename and unlink. They have the advantage of not forking another process. Caveat, rename does not usually work across file system boundaries. File::Copy is a better hammer, from the standard distrubution.

Update: Maybe File::Path does what you want. It allows creation and removal of directory trees.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: ( Move or Delete Files )
by defyance (Curate) on May 13, 2002 at 01:59 UTC
    I actually thought about unlink. My question is, will it descend into a dir, and recursively delete? I consulted the unlink reference here, and tested after you made this suggestion, and found that it doesn't(possibly due to su restrictions). rmdir() would work for this, but it will not support deleting a directory recursively, any other suggestions?

    -- Yes, I am a criminal. My crime is that of defyance.

      No, unlink doesn't recurse.

      You can, however, use it in tandem with File::Find to get the appropriate effect (or turn to File::Path's rmtree, which does this for you).

          --k.


        I wish children worked like perl. Cuz, I'd like to unlink the stink from my little girls bum....

        But I'd never want to unlink the look on her face after she stinks up a diaper!

        Couldn't help it, she was crapin, while I was hackin!

        But seriously, I'm gonna hack out something with File::Path(if I have it). This seems like the direction I need to head in.

        -- Yes, I am a criminal. My crime is that of defyance.