//Perl Simple File Find

The below example runs and simply prints the file names of files inside the c:temp folder, you will need to add the behaviour you require on the “print” line:

Command line call:

perl.exe c:find.pl c:temp


use strict;
use File::Find;

my ($area) = @ARGV;
my(@files, $file);

find(&wanted, $area);
		foreach $file(@files){
			if (-f $file){
				print "File: $filen";
sub wanted {
	push @files, $File::Find::name;
	return @files;


File: c:temp/find.txt
File: c:temp/find2.txt
File: c:temp/find3.txt
File: c:temp/find4.txt
File: c:temp/regfind.exe

By |2008-08-27T16:56:15+01:00August 27th, 2008|Perl|0 Comments

About the Author: