Sep-09-2018, 10:26 AM
(This post was last modified: Sep-09-2018, 10:26 AM by SoulsKeeper.)
I need to extract the comment Data which you can usually see on the side after opening a Zip or a Rar file, I want to extract it into a list on a .txt file
this is what i got so far
the entire folder I am trying to do this on has 2000 files and all of them are named
unzipme
but they all have an incremented extension:
unzipme.0
unzipme.1
unzipme.2
and so on
how can I change this line
this is what i got so far
import os
os.listdir(path=r'C:\Users\user\Desktop\archives')
from zipfile import ZipFile
zipfiles = ["unzipme.*",]
for zfile in zipfiles:
print("Opening: {}".format(zfile))
with ZipFile(zfile, 'r') as testzip:
print(testzip.comment) # comment for entire zip
l = testzip.infolist() #list all files in archive
for finfo in l:
# per file/directory comments
print("{}:{}".format(finfo.filename, finfo.comment))but I get an Error, it has a problem with this line:zipfiles = ["unzipme.*",]I think I need to change unzipme.* to an actual file name.
the entire folder I am trying to do this on has 2000 files and all of them are named
unzipme
but they all have an incremented extension:
unzipme.0
unzipme.1
unzipme.2
and so on
how can I change this line
zipfiles = ["unzipme.*",]so I can do what I need to do on the entire folder?
