python tarfile adding files without directory hiearchy

Posted by theactiveactor on Stack Overflow See other posts from Stack Overflow or by theactiveactor
Published on 2010-02-10T19:21:54Z Indexed on 2010/05/14 14:24 UTC
Read the original article Hit count: 193

Filed under:
|

When I invoke add() on a tarfile object with a file path, the file is added to the tarball with directory hiearchy associated .In other words, if I unzip the tarfile the directories in the original dir hiearchy are reproduced.

Is there a way to simply add a plainfile without directory info that untarring the resulting tarball produce a flat list of files?

© Stack Overflow or respective owner

Related posts about python

Related posts about tar