Question

I have thousands of gz files, each gz file has one XML file compressed.
I need to parsing all the files by Perl.
It works fine when using following Perl code:

my $fh = IO::Uncompress::Gunzip->new($file);  
while($_ = <$fh>) {  
    ...  
}

My question is, is it possible to get the last modify time of the XML file? I've tried stat($fh))[9] but always returns the epoch time.

Thanks for your kindly help.

Était-ce utile?

La solution

Use:

stat($file)[9]

The Gunzip stream doesn't have a modification time, only the actual file does.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top