if (-d $file) { print "\nDirectory: $file\n" >> "test.txt"; &scandir($file); next; }