can tarfile maintain directory structure?

Lars Gustaebel lars at
Wed Aug 18 11:01:48 CEST 2004

On Tue, 17 Aug 2004 21:06:45 -0500, Jeff Epler wrote:

> You can use os.walk (or os.path.walk for older versions of Python) to
> recurse a directory tree.  Here's a simple script to use tarfile and
> os.walk:
> [snip]

Far too complicated... is rather high-level:

import tarfile

tar =, "w:gz")

The add() method is recursive by default. More information and examples

Lars Gustäbel
lars at

More information about the Python-list mailing list