Use the zipfile.ZipFile () function in read-mode in the following way. Result = uz(io.BytesIO(zf.open(e). Below is an example program that shows you how to open a zip file without temporarily extracting it in Python. Just open the zip file in Winzip, double click on the image file (or right click on it, click open). This isn't a shell script, but it does what was suggested in the original question: #!/usr/bin/python stolen from this answer.Įg: unzip -p Zip1.zip Zip1/zip2.zip| jar -tįound the relevant Serverfault thread from your - comment. There is a known issue in the Windows 10 October Update where the consent prompt Do you want to replace these files is missing when copying contents from a. Adapting the python one liner from this answer to a similar question does the trick.Įg: unzip -p Zip1.zip Zip1/zip2.zip| python -c 'import zipfile,sys,StringIO print "\n".join(zipfile.ZipFile(StringIO.StringIO(())).namelist())'Īdded: The Java jar tool can read from stdin. ZIP file without extracting them, they might not be copied or moved correctly, even though it looks like they have been. Unfortunately the unzip program doesn't have an option to read from stdin for some reason. The unzip -p flag will pipe the uncompressed data to stdout.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |