Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Archive::Zip Modify Date Oddity

by pmqs (Friar)
on Jan 04, 2017 at 10:46 UTC ( [id://1178905]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Archive::Zip Modify Date Oddity
in thread Archive::Zip Modify Date Oddity

Zip64 support doesn't have anything to do with the granularity of the timestamp recorded in the zip file. It just allows file larger than 4Gig to be stored in a zip archive.

The two second time granularity is dealt with in modern zip implementations by storing an extended timestamp field.

Archive::Zip::SimpleZip supports this field.

Replies are listed 'Best First'.
Re^4: Archive::Zip Modify Date Oddity
by lhchin (Novice) on Jan 05, 2017 at 08:34 UTC
    Thank you for the info. SimpleZip is not install as basic Perl Library.
    Alternatively running the shell Zip command within Perl handles the Modify date correctly, which is a simpler solution.
      SimpleZip is just a wrapper around IO::Compress::Zip. IO::Compress::Zip is a core library and also supports the extended timestamp.
        use IO::Compress::Zip qw(zip $ZipError); my $zip = zip [$0] => 'test.zip', Name => 'test.txt', exTime => [$atime, $mtime, $ctime] or die;
        Well, it still does not retain the original modified date of the file, losing the seconds resolution. Not sure if this is correct, perhaps someone could share and prove that the original modified date can be retained.
        Keeping things simple, Perl shell execution Zip doesn't require much setting to retain the original modified date.
        Thanks for the result, but this is what I am getting,
        first is the shell zip, which retained the timestamp.
        next is perl zip which timestamp became current.
        lastly is perl zip with extime which timestamp rounded down to even seconds.

        OS RHEL
        $ stat abc | grep Mod Modify: 2017-01-09 18:46:05.000000000 -0800 $ zip abc.zip abc adding: abc (stored 0%) $ unzip abc.zip Archive: abc.zip replace abc? [y]es, [n]o, [A]ll, [N]one, [r]ename: r new name: abc2 extracting: abc2 $ stat abc2 | grep Mod Modify: 2017-01-09 18:46:05.000000000 -0800 $ rm abc.zip $ perl -M'IO::Compress::Zip qw(zip)' -e ' zip "abc" => "abc.zip" ' $ unzip abc.zip Archive: abc.zip replace abc? [y]es, [n]o, [A]ll, [N]one, [r]ename: r new name: abc3 inflating: abc3 $ stat abc3 | grep Mod Modify: 2017-01-10 15:54:35.000000000 -0800 $ rm abc.zip $ perl -M'IO::Compress::Zip qw(zip)' -e ' zip "abc" => "abc.zip", exT +ime => [$atime, $mtime, $ctime] ' $ unzip abc.zip Archive: abc.zip replace abc? [y]es, [n]o, [A]ll, [N]one, [r]ename: r new name: abc4 inflating: abc4 $ stat abc4 | grep Mod Modify: 2017-01-09 18:46:04.000000000 -0800

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1178905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-04-18 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found