Dear Monks
I need the last modified time from the files in a zipped archive. Here is my test code
#! /usr/bin/perl -l
use strict ;
use warnings ;
use Data::Dumper ;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
# Read a Zip file
my $zip = Archive::Zip->new();
unless ( $zip->read( 'out.zip' ) == AZ_OK ) {
die 'read error';
}
my @members = $zip->members();
foreach my $element(@members)
{
printf("%d %s %s\n",
$element->lastModFileDateTime(),
scalar(localtime($element->lastModFileDateTime())),
$element->fileName()
);
}
Output:
983734011 Sun Mar 4 20:26:51 2001 dir3/
983734011 Sun Mar 4 20:26:51 2001 dir3/file3
However, here is the output from
unzip
$> unzip -l out.zip
Archive: out.zip
Length Date Time Name
-------- ---- ---- ----
0 05-02-09 18:55 dir3/
0 05-02-09 18:55 dir3/file3
-------- -------
0 2 files
Note that the dates do not match. I guess there is a logical explanation for this, any suggestion ?
Cheers
LuCa
UPDATE: thnx derby,
lastModTime solved it!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.