Python Forum
get "Birthdate" from File inside a Zipfile
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get "Birthdate" from File inside a Zipfile
I am using the zipfile Module to extract and detect the Birthdate of a file inside a Zip, but as soon as i extract the file to get the Date from the File i recieve the current Date when the File was extracted. Doesnt the Zipfile Module support getting the "real" Birthdate of the File or is there an Option to preserve the Date and just copy it when extracting ?

the Code i use currently is

from zipfile import ZipFile
		with ZipFile('f:/', 'r') as zipObj:
  		 # Get a list of all archived file names from the zip
			listOfFileNames = zipObj.namelist()
  		 # Iterate over the file names
			for fileName in listOfFileNames:
			 # Check filename endswith .diz
				if fileName.endswith('.diz'):
					zipObj.extract(fileName, 'f:/temp_diz')	
			 # Extract file_id.diz from zip
		create_date = os.stat("f:/temp_diz/file_id.diz")[8]
		print (time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(create_date)))

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020