in reply to Re: Need to delete empty directories.
in thread Need to delete empty directories.

I can delete empty directory with rmdir.
Since if I delete some directory -it's parent directory can
become empty-I need to delete it too.
Thus what I need is loop of deletions of empty directories.
However I want to limit this loop to the maximum
deepness.
Thanks in advance.
  • Comment on Re^2: Need to delete empty directories.

Replies are listed 'Best First'.
Re^3: Need to delete empty directories.
by sh1tn (Priest) on Mar 09, 2005 at 13:56 UTC
    use strict; use File::Find; my @topdirs = @ARGV; my @rmdirs; find( sub { -d and push @rmdirs, $File::Find::name }, @topdirs ); rmdir for reverse @rmdirs;