NAME
File::EmptyDirs - find all empty directories in a path and remove recursively
SYNOPSIS
use File::EmptyDirs 'remove_empty_dirs';
my @abs_dirs_removed = remove_empty_dirs('/home/myself');
my $count_removed = remove_empty_dirs('/home/otherself');
DESCRIPTION
Ever end up with some miscellaneous empty directories in a messy filesystem and you just want to clean up all empty dirs?
For example.. If you have..
/home/myself/tp/this/nada
And the only thing in this is 'nada', and 'nada' does not contain anything, you'd like to remove both of those. This is what to use. Remove empty directories recursively.
Nothing exported by default.
The operation is self exclusive, that is, if you pass dir /home/myself, it will not delete /home/myself if it is an empty dir.
SUBS
remove_empty_dirs()
Argument is an abs path to a directory. Will remove all empty directories within that filesystem hierarchy, recursively.
Returns number of dirs removed in scalar context. In list context, returns abs paths to dirs removed.
Returns undef on failure.
SEE ALSO
File::Find::Rule::DirectoryEmpty - used internally to find the empty dirs. IO::All, might want to check this out. ermdir, included cli.
AUTHOR
Leo Charre leocharre at cpan dot org
COPYRIGHT
Copyright (c) 2010 Leo Charre. All rights reserved.
LICENSE
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".
DISCLAIMER
This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.