parse tar file with python

Aurelio Martin Massoni amartin at traza-si.com
Wed Jun 12 11:09:40 EDT 2002


"Shagshag13" <shagshag13 at yahoo.fr> escribió en el mensaje
news:ae7498$4jven$1 at ID-146704.news.dfncis.de...
> hello,
>
> i 'm not sure this is the right place to ask, but maybe somebody had
already do some kind of python code on this :
>
> i had hundred thousand of small files, my program is very slow. I'm
thinking that i loose time waiting for opening/closing, and i
> think this could be best if i "tar" my files by blocks.
>
> But in this case i don't know how to check for the end of a file and how
to get its name (both in a tar archive) ...
> (i don't want to tar/untar with python, just to be able to do a sequential
reading of a tar file to get its content)
>
> do you have an idea ?
>
> thanks in advance,
>
> s13.
>
>

Maybe you can use the zipfile module, since it is available with the Python
Library. I have found tar.py in Zope, but only to write tar files, not to
read them. If you don't want to compress the files inside the archives you
create with zipfile, use the ZIP_STORED constant instead of ZIP_DEFLATED.

Hope this helps

    Aurelio






More information about the Python-list mailing list