Zippping a directory recursively from Python script on Windows
maxm at mxm.dk
Thu Mar 11 09:54:04 CET 2004
Mike C. Fletcher wrote:
> Max M wrote:
> Honestly, I wouldn't do this myself, I just tell everyone to get tar and
> gzip, but here's a simple example of using ZipFile for creating zips of
> directories. You'd want to check for .jpg, .mpg, etceteras and avoid
> compressing those most likely, but the basics are there.
Ok I got around to trying out the tarfile module, and as usual it was
far easier than I would have suspected.
package = 'somedir'
tf = tarfile.open('%s.tar.gz' % package, 'w:gz')
So much for using command line tools for this... ;-)
Thanks for all the pointers.
regards Max M
More information about the Python-list