请教各位大侠, 这段代码,有何错误,一直出错在“ opendir(FIL,"$path1") || die "cannot open dir $path1";
如果我把这句改成“ opendir(FIL,"y:\diaglog\5D2CKT1") || die "cannot open dir $path1"; 则可以过。
不明白$path1 打印出来就是"y:\diaglog\5D2CKT1" ,为何用变量就不过呢
open (barlistfile, "f:\\logbreak\\taglist.txt") || die "Cannot find $line on $path";
@barlist=<barlistfile>;
close(barlistfile);
print (@barlist, "\n"); $sourcepath="y:\\diaglog";
$zippath="f:\\logbreak\\zip";
$unzippath="f:\\logbreak\\unzip";
$line=undef;
foreach $line(@barlist)
{
$path1=$sourcepath."\\".$line;
print ($path1, "\n");
opendir(FIL,"$path1") || die "cannot open dir $path1";
@datepath=readdir(FIL);
#print @datepath;
$line1=undef;
foreach $line1(@datepath)
{
print ($line1,"\n");
#$path2=$path1."\\".$line1."\\".$line.".zip";
#print ($path2, "\n");
#system("copy $path2 $zippath");
}
}
如果我把这句改成“ opendir(FIL,"y:\diaglog\5D2CKT1") || die "cannot open dir $path1"; 则可以过。
不明白$path1 打印出来就是"y:\diaglog\5D2CKT1" ,为何用变量就不过呢
open (barlistfile, "f:\\logbreak\\taglist.txt") || die "Cannot find $line on $path";
@barlist=<barlistfile>;
close(barlistfile);
print (@barlist, "\n"); $sourcepath="y:\\diaglog";
$zippath="f:\\logbreak\\zip";
$unzippath="f:\\logbreak\\unzip";
$line=undef;
foreach $line(@barlist)
{
$path1=$sourcepath."\\".$line;
print ($path1, "\n");
opendir(FIL,"$path1") || die "cannot open dir $path1";
@datepath=readdir(FIL);
#print @datepath;
$line1=undef;
foreach $line1(@datepath)
{
print ($line1,"\n");
#$path2=$path1."\\".$line1."\\".$line.".zip";
#print ($path2, "\n");
#system("copy $path2 $zippath");
}
}