473,772 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't stat e:: Unknown file or directory ???

Abe
I have a strange Perl problem I don't understand. I've written the
following program to scan different disks on a Windows server to look
for directory files. Works fine until it gets to 'e:' when I get this
warning:

Can't stat e:: Unknown file or directory

(If I don't have the "use warnings" in the code I get no message.)

There are folders and files on e:. I don't understand what the
problem is but I suspect there's some kind of syntax issue.

use File::Find;
use warnings;

@disks = ('h:','g:','f:' ,'e:','d:');

$rfile = "sharebug.t xt";
open (OFILE, ">$rfile") || die "Can't Open $rfile: $!\n";

foreach $disk (@disks)
{
printf ">>>Search disk: %s\n", $disk;
printf OFILE ">>>Search disk: %s\n", $disk;
@dir = ($disk);
find (\&wanted, @dir);
$dir = ();
}
close (OFILE);
exit;

sub wanted
{
use warnings;
$fname = $_;
if (-d $fname)
{
printf OFILE "$File::Find::n ame\n";
}
}
** Due to SPAM I no longer receive email responses to
** newsgroup postings, so don't bother.
Jul 19 '05 #1
2 6254
In article <pt************ *************** *****@4ax.com>, Abe
<ma*******@PLEA SE.NOSPAM.gags-r-us.org> wrote:
I have a strange Perl problem I don't understand. I've written the
following program to scan different disks on a Windows server to look
for directory files. Works fine until it gets to 'e:' when I get this
warning:

Can't stat e:: Unknown file or directory

(If I don't have the "use warnings" in the code I get no message.)

There are folders and files on e:. I don't understand what the
problem is but I suspect there's some kind of syntax issue.
If it were a syntax issue, perl would tell you about it. It is more
likely a permissions issue. I don't have a Windows server to test your
program, however. It looks like your syntax is fine.

I can make some suggestions:
use strict;
use File::Find;
use warnings;

@disks = ('h:','g:','f:' ,'e:','d:');
my @disks = ... # for this and all other variables

$rfile = "sharebug.t xt";
open (OFILE, ">$rfile") || die "Can't Open $rfile: $!\n";

foreach $disk (@disks) foreach my $disk ( @disks )
{
printf ">>>Search disk: %s\n", $disk;
printf OFILE ">>>Search disk: %s\n", $disk;
@dir = ($disk);
You don't need to define an array to pass to find(). Perl will form an
array from all of your parameters and pass it to the subroutine.
Therefore, 'find ( \&wanted, $disk );' works fine.
find (\&wanted, @dir);
$dir = ();
You don't need this in any case. There is no relation between $dir and
@dir (other than they live in the same glob).
}
close (OFILE);
exit;

sub wanted
{
use warnings;
There is no need to repeat 'use warnings' here.
$fname = $_;
if (-d $fname)
{
printf OFILE "$File::Find::n ame\n";
}
}


Last suggestion: post further questions to comp.lang.perl. misc. This
newsgroup is defunct.
Jul 19 '05 #2
Abe
Thanks. I just posted a slightly cleaned up version in the other
newsgroup.

I don't think it's a permission problem because if I change the
"@disk=" line to this:

@disks = ('h:','g:','f:' ,'e:\\','d:');

It handles all the drives just fine.
On Tue, 23 Nov 2004 13:00:29 -0800, Jim Gibson
<jg*****@mail.a rc.nasa.gov> wrote:
In article <pt************ *************** *****@4ax.com>, Abe
<ma*******@PLE ASE.NOSPAM.gags-r-us.org> wrote:
I have a strange Perl problem I don't understand. I've written the
following program to scan different disks on a Windows server to look
for directory files. Works fine until it gets to 'e:' when I get this
warning:

Can't stat e:: Unknown file or directory

(If I don't have the "use warnings" in the code I get no message.)

There are folders and files on e:. I don't understand what the
problem is but I suspect there's some kind of syntax issue.


If it were a syntax issue, perl would tell you about it. It is more
likely a permissions issue. I don't have a Windows server to test your
program, however. It looks like your syntax is fine.

I can make some suggestions:
use strict;
use File::Find;
use warnings;

@disks = ('h:','g:','f:' ,'e:','d:');


my @disks = ... # for this and all other variables

$rfile = "sharebug.t xt";
open (OFILE, ">$rfile") || die "Can't Open $rfile: $!\n";

foreach $disk (@disks)

foreach my $disk ( @disks )
{
printf ">>>Search disk: %s\n", $disk;
printf OFILE ">>>Search disk: %s\n", $disk;
@dir = ($disk);


You don't need to define an array to pass to find(). Perl will form an
array from all of your parameters and pass it to the subroutine.
Therefore, 'find ( \&wanted, $disk );' works fine.
find (\&wanted, @dir);
$dir = ();


You don't need this in any case. There is no relation between $dir and
@dir (other than they live in the same glob).
}
close (OFILE);
exit;

sub wanted
{
use warnings;


There is no need to repeat 'use warnings' here.
$fname = $_;
if (-d $fname)
{
printf OFILE "$File::Find::n ame\n";
}
}


Last suggestion: post further questions to comp.lang.perl. misc. This
newsgroup is defunct.

** Due to SPAM I no longer receive email responses to
** newsgroup postings, so don't bother.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2768
by: Richard Hanson | last post by:
Over the last few days, I reinstalled Win2kSP2 to a spare harddrive I had just swapped into my Fujitsu LifeBook P1120 (long story <wink>). Subsequently, I DL'ed the newest Python alpha (2.4a2), and when trying to install it, I immediately got this error: This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service.
1
2095
by: | last post by:
Hello, I tried to build Python 2.4.1 on a Reliant Unix system. Just after the python executable program has been built, I get the following error: ==== begin make output === CC -W1 -Blargedynsym -o python \ Modules/python.o \ libpython2.4.a -lresolv -lsocket -lnsl -ldl -lm
10
5278
by: David Farning | last post by:
I am new to c and not yet sure of the boundary between c and it's implementations. So please redirect me if this should be asked elsewhere. I am working on a function to determine if a directory exists. The idea comes from a snippet I found in a samba source file. bool dirExist(char *dname) { struct stat *stbuf; //stbuf = (struct stat*)malloc(sizeof(struct stat));
2
11170
by: electric sheep | last post by:
I'm not sure if this is POSIX or not ... and indeed if POSIX is OT here or not, but if the subject made sense to you .... I have a very simple program here, but it seems to be returning a "true" value to the query S_ISDIR() even when the directory entry is not a directory. #include <stdio.h> #include <dirent.h> #include <sys/stat.h>
3
3948
by: David Bear | last post by:
I'm trying to use os.chmod and am refered to the stat module. Is there are explanation of: * S_ISUID * S_ISGID * S_ENFMT * S_ISVTX * S_IREAD * S_IWRITE * S_IEXEC
0
1703
by: Theo Kanter | last post by:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 22 Message-ID: <Ca52h.21400$E02.8869@newsb.telia.net> Date: Wed, 01 Nov 2006 17:53:38 GMT NNTP-Posting-Host: 81.232.22.128 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1162403618 81.232.22.128 (Wed, 01 Nov 2006 18:53:38 CET) NNTP-Posting-Date: Wed, 01 Nov 2006 18:53:38 CET Organization: Telia Internet
24
6128
by: Joe Salmeri | last post by:
I just upgraded from Python 2.4.2 to Python 2.5.1 and have found some unexpected behavior that appears to be a bug in the os.stat module. My OS is Windows XP SP2 + all updates. I have several programs that have worked flawlessly on all previous Python versions for years and they are now producing incorrect results in the code that uses os.stat. Searching through the 2.5.1 release notes I found the following:
1
5515
by: georgewa | last post by:
Greetings all, great forum, this is my first post. Recently trying to write a script that is designed to move files based on timestamps. I am fairly new to Perl, so please bare with me. I have written a short script that should iterate through all files in the current directory and output unix epoch time. The script in it's entirety is posted below: #!/usr/bin/perl use warnings; use strict; use Cwd; use File::Find;
1
2028
by: perlvasu | last post by:
6 jobs are running at the same time and accessing same dbm file for writing and reading. These are daily jobs and failing only some times not regularly. So i thought of this is just because of dead lock situation. So i tried to put flock here in the following code. But i got the following error. Can't locate object method "fd" via package "SDBM_File" Can any body help me in this case. use strict ; use warnings ; use SDBM_File ;
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.