finding a file in a directory and reading it 
Author Message
 finding a file in a directory and reading it

Hi,
I am trying to open a directory and get the latest file in that
directory and then open that file to read some information from it.

What I am using now is this part:


opendir(DIR, $mns_dir) || die("Cannot open directory");
while (my $tempfiles = readdir DIR) {
  print $tempfiles  if $tempfiles =~
/RPTPRINT.MNS206AR.24Jun01_13.37.48.Z/;

Quote:
}

closedir DIR;

it gives me an error message "Use of uninitialized value at
qf_system_blast.pl line 179."

This file is compressed ".Z", can I open it compressed or no?
what am I doing wrong?

thanks
Nina



Fri, 12 Dec 2003 11:29:31 GMT  
 finding a file in a directory and reading it
does $mns_dir have a value?


Quote:
> Hi,
> I am trying to open a directory and get the latest file in that
> directory and then open that file to read some information from it.

> What I am using now is this part:


> opendir(DIR, $mns_dir) || die("Cannot open directory");
> while (my $tempfiles = readdir DIR) {
>   print $tempfiles  if $tempfiles =~
> /RPTPRINT.MNS206AR.24Jun01_13.37.48.Z/;
> }
> closedir DIR;

> it gives me an error message "Use of uninitialized value at
> qf_system_blast.pl line 179."

> This file is compressed ".Z", can I open it compressed or no?
> what am I doing wrong?

> thanks
> Nina



Fri, 12 Dec 2003 11:50:26 GMT  
 finding a file in a directory and reading it

Quote:


>opendir(DIR, $mns_dir) || die("Cannot open directory");
>while (my $tempfiles = readdir DIR) {
>  print $tempfiles  if $tempfiles =~
>/RPTPRINT.MNS206AR.24Jun01_13.37.48.Z/;
>}
>closedir DIR;

>it gives me an error message "Use of uninitialized value at
>qf_system_blast.pl line 179."

Which line is 179?

Quote:
>This file is compressed ".Z", can I open it compressed or no?

Yes.  try

        open ZFILE, "compress -dc $filename |" or die ...;

If this 'open' succeeds, then you can read the uncompressed data from
ZFILE as usual.

rd
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print



Sat, 13 Dec 2003 03:40:53 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Reading directories, entering directories, chaning file permissions...

2. File Directory and read File

3. Reading files in a directory and printing to one txt file

4. File::Find with Compressed NTFS directories

5. Deleting empty sub directories with File::Find

6. Get directory only once and put it in array with File::Find

7. File::Find directory conundrum

8. File::Find: how to exclude directories?

9. finding the newest file in a directory

10. Finding the last-newest file in a directory

11. stat can't find file or directory

12. File::Find without desending into sub directories

 

 
Powered by phpBB® Forum Software