Thanks in advance!
Zip Files
Moderator: General Moderators
-
cavaliernavyman
- Forum Newbie
- Posts: 3
- Joined: Mon Jan 19, 2009 9:34 pm
Zip Files
Hello fellow code monkeys. I have a problem which I have beat my head against a wall
trying to solve. I want to unzip the contents of a zip file AND save/extract/view the ORIGINAL date modified. But when I use extractTo($zip_file_name), the date modified is reset. Does anyone know of a way to check the date modified of each file before unzipping it, or perhaps another solution?
Thanks in advance!
Thanks in advance!
Re: Zip Files
http://www.techotopia.com/index.php/PHP ... _Attribute check that article it might help
-
cavaliernavyman
- Forum Newbie
- Posts: 3
- Joined: Mon Jan 19, 2009 9:34 pm
Re: Zip Files
it2051229, thanks for the post; however, I couldn't find the solution there. It is a well written guide for working with files in PHP though...
-
jack_indigo
- Forum Contributor
- Posts: 186
- Joined: Sun Jun 08, 2008 11:25 pm
Re: Zip Files
Huh? You already have $zip_file_name, right? Or do you need us to show you how to use dir() to iterate a directory of files? Anyway, then if you look in that link that it2051229 had posted, you'd see this gem:cavaliernavyman wrote:it2051229, thanks for the post; however, I couldn't find the solution there. It is a well written guide for working with files in PHP though...
Code: Select all
<?php
$results = stat ("/tmp/php_essentials.txt");
echo "File size is $results[size]" . "<br>";
echo "File last modifed on $results[mtime]" . "<br>";
echo "File occupies $results[blocks] filesystem blocks" . "<br>";
?>-
cavaliernavyman
- Forum Newbie
- Posts: 3
- Joined: Mon Jan 19, 2009 9:34 pm
Re: Zip Files
OK, to clarify. I understand how to unzip files, and I know how to get all kinds of information about the new file, including its date modified. BUT, in the process of unzipping the file, the date modified is RESET. Thus, if I created the file on March 16th and zipped it, you'll see that inside the zip, the file has March 16th as the date last modified. But, if you use PHP to unzip the file, the new file will have, in this case, Jan 20th as its date last modified. What I want to know is how to preserve the date last modified, or at least access it before unzipping...
Thanks for all the help folks
Thanks for all the help folks
-
jack_indigo
- Forum Contributor
- Posts: 186
- Joined: Sun Jun 08, 2008 11:25 pm
Re: Zip Files
Good luck on that one. To be honest I think you'll be looking at writing something in C or C++ and linking it in as a PHP module (or do a cheesy shell out to command line with backtick characters) to do what you're asking.