Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Reading in win2k

Status
Not open for further replies.

jmdc

MIS
Joined
Feb 2, 2001
Messages
19
Location
US
This code looks ok to me, but I keep getting a "Sorry can't open c:\Logs directory: Permission denied when trying to read this file. I made sure the correct permissions were set. Can anyone please help.

#!perl -w

use strict;
my $srcdir="c:\\Logs";
my @files=();

open(DIR, $srcdir) or
die "Sorry can't open $srcdir directory: $!\n";

@files=readdir(DIR) or
die "Unable to read directory $srcdir: $!\n";

closedir(DIR);

print "@files!\n";

-Justin

 
Change

Code:
open(DIR, $srcdir)

to

Code:
opendir(DIR, $srcdir)

And you should be good to go...

[hth] Notorious P.I.G.
 
That worked! Thanks.

-Justin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top