Click here to get back home

File::Find Win32 Examples

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
File::Find Win32 Examples BartlebyScrivener 10-26-2005
Posted by BartlebyScrivener on October 26, 2005, 11:51 am
Please log in for more thread options


I am trying to learn Perl using the latest ActiveState on a Windows XP
machine.

Most of the examples I find for using modules are made for Linux users.
So when I set out to learn find2perl or File::Find the scripts usually
don't work because of pathname problems, (or so I assume).

Could someone please supply a file::find example for a windows xp
machine?

For instance, my drives are usually partitioned with data on d:\. How
would I search all files on d: drive for any file containing the string
"perl amateur"

Thank you for any help.



Posted by Reinhard Pagitsch on October 27, 2005, 12:52 pm
Please log in for more thread options




BartlebyScrivener wrote:
> I am trying to learn Perl using the latest ActiveState on a Windows XP
> machine.
>
> Most of the examples I find for using modules are made for Linux users.
> So when I set out to learn find2perl or File::Find the scripts usually
> don't work because of pathname problems, (or so I assume).
>
> Could someone please supply a file::find example for a windows xp
> machine?
>
> For instance, my drives are usually partitioned with data on d:\. How
> would I search all files on d: drive for any file containing the string
> "perl amateur"
>
> Thank you for any help.

More detailed error messages would be helpfull to reproduce the problem.
But it is similar the same as on UNIX/Linux, except that you have to use
/ instead of \.

eg:
my $dir = "D:/test/data";


sub wanted
{
        if(!-d $File::Find::name)
        {
                print $File::Find::name . "\n";
        }
}


find(\&wanted, $dir);

--
regards,
Reinhard


Posted by BartlebyScrivener on October 27, 2005, 7:17 am
Please log in for more thread options


Thank you very much. I shall take another stab and report back with any
errors.

This line has me stumped:

if(!-d $File::Find::name)

I see != as a comparison operator in my Perl book, but not !-

Thank you again.

BS



Posted by Reinhard Pagitsch on October 27, 2005, 4:29 pm
Please log in for more thread options


BartlebyScrivener wrote:
> Thank you very much. I shall take another stab and report back with any
> errors.
>
> This line has me stumped:
>
> if(!-d $File::Find::name)
>
> I see != as a comparison operator in my Perl book, but not !-

This !-d tests if the "file" is NOT a directory.
Look in the perlfunc man page for the -X FILEHANDLE.

--
regards,
Reinhard


Posted by BartlebyScrivener on October 27, 2005, 7:53 am
Please log in for more thread options


It works! Thanks so much for your help.

bs



Similar ThreadsPosted
A do-file location: how the code inside that do-file find it? January 20, 2008, 12:32 am
File::Find on Solaris v8-10 August 1, 2005, 11:06 am
Win32::ODBC Find Primary Key Column February 6, 2005, 8:21 pm
Noob Q: Ways for module to find config file? March 3, 2005, 5:47 pm
Win32::OLE and CAPICOM to find a certificate in certificate store will raise exception July 20, 2006, 2:44 am
Win32::File August 29, 2004, 9:08 pm
XML::Parser examples for the novice November 15, 2005, 11:31 am
DBIx::Threaded examples April 24, 2008, 1:21 pm
Problem printing a file uing Win32::Printer September 30, 2006, 3:36 pm
need help with HTTP-WebTest module, tutorials or examples September 8, 2007, 1:19 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap