Comment compresser tout un dossier
import tarfile,os def arch_dir(filename_arch, source_path): #'/home/pascal/test4.tar.gz' tf = tarfile.open(filename_arch,'w:gz') tf.add(source_path,arcname = os.path.split(source_path)[-1]) tf.close() if __name__=='__main__': src='/home/pascal/dev/bottle' arc='/home/pascal/test1.tar.gz' arch_dir(arc,src)