Archiving Modules

peter peter.mosley at talk21.com
Wed Feb 16 14:33:26 CET 2011


I am writing a small Tkinter utility to control archive files in
multiple formats (mainly for my own amusement and education).
Basically it presents the user with two adjacent listboxes, one with
the contents of the target directory and one with the contents of the
archive. By clicking buttons labelled '<' and '>' the user can copy
files to and from the archive.  The actual archiving functionality
derives from the modules zipfile and tarfile.

It all seems to be working fine, but I have two residual queries.
Firstly for the sake of completeness I would like to include .rar
archives, but there doesn't seem to be an equivalent rarfile module.
I use both Windows and Linux on various machines, so need a cross
platform solution which does not depend on external modules. The only
one I have found is at http://pypi.python.org/pypi/rarfile/1.0, but it
seems this does rely on an external module.  Is there anything out
there?

Secondly, I found that when extracting zip files, the date stamps were
all reset to the date/time of extraction, whereas for tar files they
retained their original values. This second behaviour seems more
logical, and I have simulated it for the zipfiles by using
zipfile.getinfo to read the original date then os.utime to rewrite
it.  It seems rather messy - have I missed something simple like a
flag setting within zipfile?

Peter





More information about the Python-list mailing list