Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Need to delete empty directories.

by rinceWind (Monsignor)
on Mar 09, 2005 at 12:57 UTC ( [id://437884]=note: print w/replies, xml ) Need Help??


in reply to Need to delete empty directories.

The point is, that you have an empty skeleton directory tree. The toppermost directories are not themselves empty as they contain directories.

Here is a technique I use in one of my module tests for removing the directory 'test' and anything below:

find( { bydepth => 1, wanted => sub { if (-d $_) { rmdir $_; } else { 1 while unlink $_; } }, }, 'test') if -d 'test'; rmdir 'test';
In case you are wondering about 1 while unlink, check out the node.

--
I'm Not Just Another Perl Hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found