Created
March 26, 2018 15:11
-
-
Save kieranjol/e2bae8ea11444a404d4750943f135512 to your computer and use it in GitHub Desktop.
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/env python | |
| from zipfile import ZipFile | |
| import zipfile | |
| import sys | |
| import os | |
| import time | |
| import datetime | |
| def main(): | |
| pwd = os.getcwd() | |
| source = sys.argv[1] | |
| # destination = sys.argv[2] | |
| start = datetime.datetime.now() | |
| with ZipFile('compression.zip', 'w',zipfile.ZIP_STORED, allowZip64 = True) as myzip: | |
| os.chdir(source) | |
| for root, dirnames, filenames in os.walk(source): | |
| for filename in filenames: | |
| full_path = os.path.relpath(os.path.join(root, filename)) | |
| print 'zipping %s' % full_path | |
| myzip.write(full_path) | |
| finish = datetime.datetime.now() | |
| print start, finish | |
| os.chdir(pwd) | |
| start = datetime.datetime.now() | |
| time.sleep(45) | |
| with zipfile.ZipFile('compression.zip', 'r') as myzip: | |
| print 'verifying..' | |
| print myzip.testzip() | |
| finish = datetime.datetime.now() | |
| print start, finish | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment