can tarfile maintain directory structure?

Adonis adonisv at
Wed Aug 18 03:05:59 CEST 2004

"Jay Donnell" <jaydonnell at> wrote in message
news:a6fdfd6b.0408171508.65d670d0 at
> Is there a way to use the tarfile module to recursively compress the
> contents of a directory and maintain the directory structure in the
> tar archive?
> Simply doing os.system('tar -czvf ' + fileName +'.tar.gz ' +
> directory)
>  works great on linux, but I need this script to work on windows as
> well :(

Starting from Python 2.3 there is a tarfile module in the stdlib


More information about the Python-list mailing list