If I have a need to process all of the files in a directory tree, I use find2perl to generate a template. If you are familiar with the *ix find command, there are several options you can use to your advantage, but I usually stick to find2perl / -type f -print > template.pl . You can substitute any starting directory instead of / to suit, and the -type f will limit the code to files.