|
|
Subject:
How do I use File::Find?
Category: Computers > Programming Asked by: bozo0-ga List Price: $5.00 |
Posted:
22 Sep 2004 08:11 PDT
Expires: 22 Oct 2004 08:11 PDT Question ID: 404704 |
I am using PERL v5.6.1 built for MSWin32-x86-multi-thread from ActiveState. The operating system is XP. I would like a script to search my C: drive for all the files named TESTTMP.TXT. How can I get a script below to work? use strict; use File::Find; find (\&matchPattern, 'C:/perl'); print "Search whole C: drive\n"; find (\&matchPattern, 'C:/'); sub matchPattern { if ($File::Find::name =~ m"TESTTMP.TXT") { print "$File::Find::name\n"; } } This is the output I got: C:/perl/TESTTMP.TXT C:/perl/eg/TESTTMP.TXT Search whole C: drive C:/TESTTMP.TXT This is the output I wanted but did not get: C:/perl/TESTTMP.TXT C:/perl/eg/TESTTMP.TXT Search whole C: drive C:/TESTTMP.TXT C:/perl/TESTTMP.TXT C:/perl/eg/TESTTMP.TXT |
|
Subject:
Re: How do I use File::Find?
Answered By: palitoy-ga on 22 Sep 2004 09:22 PDT Rated: |
Hello bozo0-ga I think this is the script you require: use strict; use File::Find; find (\&matchPattern, '/perl'); print "Search whole C: drive\n"; find (\&matchPattern, '/'); sub matchPattern { if ($File::Find::name =~ m"TESTTMP.TXT") { print "C:$File::Find::name\n"; } } If you have any further queries on this subject please ask for clarification and I will do my best to respond quickly. |
bozo0-ga
rated this answer:
and gave an additional tip of:
$2.00
Works perfect - thanks |
|
Subject:
Re: How do I use File::Find?
From: palitoy-ga on 22 Sep 2004 10:20 PDT |
Thanks for the 5-star rating and tip! They are both appreciated. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |