#!/perl -w use strict; print "Enter the path of the folder to print: "; chomp(my $path=); #Fix the slashes $path =~ s{\\}{\\\\}g; #Open the directory if(opendir PRINT,$path) { #Loop through the files foreach((readdir(PRINT))) { #Skip . and .. if(($_ eq ".") or ($_ eq "..")) {next;} #If it is a file if(open TEST,$path."\\".$_) { #Make sure it is a text file if(-T TEST) { #Close the file close TEST; print "currently printing: ".$_."\n"; #Print the file system("\"c:\\Program Files\\TextPad 4\\Textpad.exe\" -p \"$path.\\$_\""); } else {print $_. " is a non-text file!\n";} } else {print $_." is a folder!\n";} } } else {print "Could not open directory for printing!";}