Last active
February 8, 2016 16:10
documentazione
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
import sys | |
import documentazione | |
documentazione.comprimidocumentazione(sys.argv[1]) |
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
import sys | |
import os | |
import tarfile | |
import gzip | |
import shutil | |
import datetime | |
import glob | |
def version(): | |
print '''Versione migliorata per risolvere | |
le cazzate di windows | |
creato da Alberto Bregliano''' | |
def comprimidocumentazione(directory): | |
now = datetime.datetime.now() | |
giorno = now.strftime("%A") | |
print giorno | |
tarrato = tarfile.open("documentazione-"+giorno+".tar","w") | |
for root, dir, files in os.walk(directory): | |
for filename in files: | |
filepath = os.path.join(root, filename) | |
try: | |
tarrato.add(filepath) | |
except: | |
pass | |
tarrato.close() | |
with open("documentazione-"+giorno+".tar", 'rb') as f_in, gzip.open("documentazione-"+giorno+".tar.gz", 'wb') as f_out: | |
shutil.copyfileobj(f_in, f_out) | |
#Elimina il file .tar | |
os.remove("documentazione-"+giorno+".tar") | |
version() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment