find(sub { if (-d $File::Find::name && !$seen{$_}++) { push @folders, "$_" ; print $FOLDERS "$_\n"; } }, $cwd);