Created
August 8, 2018 01:34
-
-
Save skarllot/b5d64cb06cdd6dcfe5ea9d6744fca8f5 to your computer and use it in GitHub Desktop.
Pipes the content of GZipped Tar file to a Zip file without temporary files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import tarfile | |
import zipfile | |
tarf = tarfile.open(sys.argv[1], "r:*") | |
zipf = zipfile.ZipFile(sys.argv[2], "w", zipfile.ZIP_DEFLATED, allowZip64 = True) | |
for m in tarf: | |
if m.isreg(): | |
zipf.writestr(m.path, tarf.extractfile(m).read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment