Hello group,
 
I'm trying to read the directory "C:\GIS\wrapped_data" and write record. My 
scripts is erroring with "can't open directory: no such  file or directory. 
What am I missing?
 
$outfile = "$infile.txt";
my $dir = "C:\GIS\wrapped_data";
opendir(DIR,"$dir") or die "Can't open $dir directory: $!";
open (OUT, ">$outfile") or die "Error, cannot open file: $outfile. $!"; 
$record = "";
$index=0;
while ( $numbytes = read(DIR, $record, 1200) ) {
   $index++;
   if ($numbytes == 1200) {
      print OUT "$record";
   } else {
      die "File Read Error on record $index: $numbytes bytes read; Should be 
1200.\n"; 
   }
}
close DIR;
close OUT;


 

Carl Johnson
Principal Consultant
214-914-9509 - P
214-242-2020 - F
[EMAIL PROTECTED]



Reply via email to