hello,
Is there specific commands or parameters to use when accessing a directory on Windows ?
This is my script :
#use strict;
use warnings;
use Data:
umper;
$Data:
umper:
urity=1;
my $base="C:\\Epusbdrv";
print "base ".$base."\n";
push(@CDROM, scrute( $base ) );
print Dumper( @CDROM );
foreach $elt ( @CDROM )
{
print ($elt."\n" );
}
sub scrute {
my $rep = shift @_;
print "shift ".$rep."\n";
my $lst;
my @replst;
open REPHDL, $rep or die "rep $rep inacessible : $!" ;
@replst = readdir REPHDL;
close REPHDL;
print @replst;
foreach $elt ( @replst )
{
print $elt;
push( @lst, $elt ) if -f $elt;
foreach $toto (@lst )
{
print $toto "\n";
}
my $subdir = $rep."\\".$elt;
push( @lst, scrute( $subdir)) if -d $elt;
}
return @lst;
}
For now the opendir don't accept to open C:\Epusbdrv.
The script return :
E:\Perl>perl essai1.pl
base C:\Epusbdrv
shift C:\Epusbdrv
rep C:\Epusbdrv inacessible : Permission denied at essai1.pl line 20.
E:\Perl>
I know the directory which i try to read is not on the same disk that the perl directory. But C:\Epusbdrv hasn't restrictive permission.
Should i specify the hard disk unit or the path by a special ActivePerl function ?
Thanks for your help
Is there specific commands or parameters to use when accessing a directory on Windows ?
This is my script :
#use strict;
use warnings;
use Data:
$Data:
my $base="C:\\Epusbdrv";
print "base ".$base."\n";
push(@CDROM, scrute( $base ) );
print Dumper( @CDROM );
foreach $elt ( @CDROM )
{
print ($elt."\n" );
}
sub scrute {
my $rep = shift @_;
print "shift ".$rep."\n";
my $lst;
my @replst;
open REPHDL, $rep or die "rep $rep inacessible : $!" ;
@replst = readdir REPHDL;
close REPHDL;
print @replst;
foreach $elt ( @replst )
{
print $elt;
push( @lst, $elt ) if -f $elt;
foreach $toto (@lst )
{
print $toto "\n";
}
my $subdir = $rep."\\".$elt;
push( @lst, scrute( $subdir)) if -d $elt;
}
return @lst;
}
For now the opendir don't accept to open C:\Epusbdrv.
The script return :
E:\Perl>perl essai1.pl
base C:\Epusbdrv
shift C:\Epusbdrv
rep C:\Epusbdrv inacessible : Permission denied at essai1.pl line 20.
E:\Perl>
I know the directory which i try to read is not on the same disk that the perl directory. But C:\Epusbdrv hasn't restrictive permission.
Should i specify the hard disk unit or the path by a special ActivePerl function ?
Thanks for your help