file-find

How can I open a file found by File::Find from inside the wanted function?

I have code like below. If I open the file $File::Find::name (in this case it is ./tmp/tmp.h) in my search function (called by File::Find::find), it says "cannot open the file ./tmp/tmp.h reason = No such file or directory at temp.pl line 36, line 98." If I open the file directly in another fuction function, I am able open the file. C...

How can I use File::Find to print files with the relative path only?

I am using File::Find in the code below to find the files from /home/user/data path. use File::Find; my $path = "/home/user/data"; chdir($path); my @files; find(\&d, "$path"); foreach my $file (@files) { print "$file\n"; } sub d { -f and -r and push @files, $File::Find::name; } As I am changing the dir path to the path from where...

How can I make Perl's File::Find faster?

I have a folder named Lib and I am using the File::Find module to search that folder in whole dir say, D:\. It's taking a long time to search, say even 5 mins if the drive has a lot of subdirectories. How can I search that Lib faster so it will be done in seconds? My code looks like this: find( \&Lib_files, $dir); sub Lib_files...

How do I pass parameters to the File::Find subroutine that processes each file?

Using File::Find, how can I pass parameters to the function that processes each file? I have a Perl script that traverses directories in order to convert some 3-channel TIFF files to JPEG files (3 JPEG files per TIFF file). This works, but I would like to pass some parameters to the function that processes each file (short of using glo...

How can I pass a parameter to the wanted function when using Perl's File::Find?

Possible Duplicate: How do I pass parameters to the File::Find subroutine that processes each file? One can use Perl's File::Find module like this: find(\&wanted, @directories); How can we add a parameter to the wanted function? for example i want to traverse the files in /tmp extracting some information from each file ...