gzipping several files

Gerrit Holl gerrit at nl.linux.org
Mon Dec 1 10:30:53 EST 2003


Byrom, R (Rob)  wrote:
> Does anyone know how to read-in several files and then batch all together
> into a *.zip format? I've looked at the gzip module but I'm not sure how to
> use this with several files. Any help gratefully received!

The gzip module is about gzip, not about zip. Zip is different from
gzip: zip is both an archiver and a compressor: it bundles several files
into 1 file, *and* compresses them. In Unix, there are two different
protocols for that: archiving is done with tar (tarfile[0]), compressing
is done with gzip or bzip[1]. If you want to create a zip file, you may
use the zipfile module ;)[2]. A good place to look for a module if you
can't find it is the standard library documentation[3]. It is very
useful!

yours,
Gerrit.

[0] http://www.python.org/dev/doc/devel/lib/module-tarfile.html
[1] http://www.python.org/dev/doc/devel/lib/module-gzip.html, 
    http://www.python.org/dev/doc/devel/lib/module-bz2.html
[2] http://www.python.org/dev/doc/devel/lib/module-zipfile.html
[3] http://www.python.org/dev/doc/devel/modindex.html

-- 
273. If any one hire a day laborer, he shall pay him from the New Year
until the fifth month (April to August, when days are long and the work
hard) six gerahs in money per day; from the sixth month to the end of the
year he shall give him five gerahs per day.
          -- 1780 BC, Hammurabi, Code of Law
-- 
Asperger's Syndrome - a personal approach:
	http://people.nl.linux.org/~gerrit/english/





More information about the Python-list mailing list