http://www.perlmonks.org?node_id=997007


in reply to How do I copy an empty directory?

#!/usr/bin/perl use File::Find; finddepth (\&empdir, ($ARGV[0] || '.')); sub empdir { return unless -d && rmdir($_); mkdir "/tmp/$_"; }

Works for me in GNU. Any "empty" directory having only empty subdirectories will be deleted also (as the empty subdirs). Adapt the line 7 to your needs