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