use IO::Dir; use File::Find::Rule; sub _is_empty_dir { my ($shortname, $path, $fullname) = @_; my $dh = IO::Dir->new($fullname) or return; my $count = scalar(grep{!/^\.\.?$/} $dh->read()); $dh->close(); return($count==0); } sub emptydirfinder { my ($self,$abs) = shift; $abs or die(); my $finder= File::Find::Rule->new; $finder->directory(); $finder->exec( \&_is_empty_dir); my @found = $finder->in($abs); return \@found; }