Setting file attributes on file creation from ZipFiles (solved) 
Author Message
 Setting file attributes on file creation from ZipFiles (solved)

I posted this question a while ago, and now that I've found the answer I thought
I'd post it back ;-)

Anyway, the problem was setting the modified dates on files I was creating by
unzipping them from a ZipFile object.

You can do this using a function as follows:

from os import utime
from time import time,mktime

def unzip_with_date(zipefile,filename):
    f = open(filename,'wb')
    utime(filename,(time(),round(mktime(zipefile.getinfo(filename).date_time +

Maybe that could be made into a method and included in ZipFile?



PS: For the curious, I found out how to do this by looking at; I love
a language where the source for the libraries is included :-)

Mon, 15 Sep 2003 07:14:29 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Setting file attributes on file creation.

2. Setting file attributes and Copying files

3. - Setting the creation/modification date for files - HOW ?

4. Setting file creation date

5. Setting file creation date

6. How do I set a text file's attributes to read-only

7. Setting Extended Attributes for files under OS/2.

8. Setting file attributes in ADA 95

9. Setting file attributes on windows.

10. Problem with exec under Win 3.11 gives error file creation bad file number

11. File Vi's and modifying file Attributes, listing by, etc

12. Unexpected results of [file writable] and [file attributes] on NTFS


Powered by phpBB® Forum Software