I am trying to extract files from a zip file using Python 2.7.1 (on Windows, for your information), and each of my attempts shows the extracted files with a modified date = time to extract (which is incorrect).
import os,zipfile outDirectory = 'C:\\_TEMP\\' inFile = 'test.zip' fh = open(os.path.join(outDirectory,inFile),'rb') z = zipfile.ZipFile(fh) for name in z.namelist(): z.extract(name,outDirectory) fh.close()
I also tried using the .extractall method, with the same results.
import os,zipfile outDirectory = 'C:\\_TEMP\\' inFile = 'test.zip' zFile = zipfile.ZipFile(os.path.join(outDirectory,inFile)) zFile.extractall(outDirectory)
Can someone tell me what I'm doing wrong?
I would like to think that this is possible without post-correction of the changed yime in How to change the date of creation of a Windows file? .
python extraction zip
MTAdmin
source share