For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > November 2005 > Find Error Message









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Find Error Message
andrewmchorney@cox.net

2005-11-21, 6:57 pm

Hello

I am working on a perl script and the 1st step is to get a list of all the files on the C drive. I am getting an error message - Can't stat c:*.*: No such file or directory

Here is my perl script:

use strict;
use warnings;
use File::Find;

$| = 1; #Autoflush STDOUT

#finddepth comes from File::Find
#finddepth searches from the bottom of the tree up

#finddepth(\&BadNames,"c:\\Directory");
find(\&BadNames,"c:\\*.*");

sub BadNames
{
print $_;
print "\n";
}

What should the find statement look like?


Timothy Johnson

2005-11-21, 6:57 pm


I think it will work if you just leave out the *.* it will work.

-----Original Message-----
From: andrewmchorney@cox.net [mailto:andrewmchorney@cox.net]=20
Sent: Monday, November 21, 2005 12:14 PM
To: beginners@perl.org
Subject: Find Error Message

Hello

I am working on a perl script and the 1st step is to get a list of all
the files on the C drive. I am getting an error message - Can't stat
c:*.*: No such file or directory

Here is my perl script:

use strict;
use warnings;
use File::Find;

$| =3D 1; #Autoflush STDOUT

#finddepth comes from File::Find
#finddepth searches from the bottom of the tree up

#finddepth(\&BadNames,"c:\\Directory");
find(\&BadNames,"c:\\*.*");

sub BadNames
{
print $_;
print "\n";
}

What should the find statement look like?
=20



usenet@DavidFilmer.com

2005-11-21, 6:57 pm

andrewmchorney@cox.net wrote:
> use File::Find;


I would recommend"

use IO::All;
print "$_\n" for io("/tmp/mp3") -> all_files(0);

Easy!!!! (everything is easy with IO::All - the Swiss Army Knife of
I/O)

Bob Showalter

2005-11-21, 6:57 pm

andrewmchorney@cox.net wrote:
> I am getting an error message - Can't stat c:*.*: No such file or directory
>
> find(\&BadNames,"c:\\*.*");
>
> What should the find statement look like?


The argument should be a directory name (or multiple directories), not a
glob pattern. So use "C:\\", or "c:/"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com