in reply to Re: cleaning up old libs and @INC
in thread cleaning up old libs and @INC
4. I was left with a lot of empty directories. I ran find with rmdir a couple of times do get rid of them.A "couple of times"??
A pure perl solution is to use File::Find and use finddepth instead of find. That way it'll kill the deepest lieing empty directories first.
Oh, and rmdir will not delete a directory if it's not empty.
So you can easily recursively delete empty directories in Perl using:
which can probably easily be converted to a one-liner — and shortened if you don't like the verbosity:use File::Find qw(finddepth); finddepth sub { -d and rmdir $_ and printf STDERR "rmdir: %s\n", $File +::Find::name }, @dirs;
I haven't tried running rmdir on a plain file. Probably it's safe.finddepth sub { -d and rmdir $_ }, @dirs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: cleaning up old libs and @INC
by daxim (Curate) on Jul 16, 2007 at 18:55 UTC |