
gerold.penz at tirol
Sep 12, 2006, 2:03 PM
Post #3 of 4
(83 views)
Permalink
|
itzel schrieb: > I need a script that group a > list of files using Tar file utility and then, compress that block > using a compress utility (gzip i think). Hi! This script packs all files and directories inside the ``source_dir`` into the TAR-GZ-Archive (``destination``): import os.path import tarfile def to_tar_gz(source_dir, destination): """ :param source_dir: Source directory name. :param destination: Destination filename. (TAR-GZ-Archive *.tar.gz) """ t = tarfile.open(name = destination, mode = 'w:gz') t.add(source_dir, os.path.basename(source)) t.close() return True Regards, Gerold :-) -- ________________________________________________________________________ Gerold Penz - bcom - Programmierung gerold.penz [at] tirol | http://gerold.bcom.at | http://sw3.at Ehrliche, herzliche Begeisterung ist einer der wirksamsten Erfolgsfaktoren. Dale Carnegie -- http://mail.python.org/mailman/listinfo/python-list
|