use File::Find; finddepth sub {(!-d or /^.{1,2}$/);rmdir},@ARGV;