Pipelining tar create and tar extract the "Python" way...

Ray Van Dolson rvandolson at esri.com
Wed Sep 23 19:22:36 EDT 2009


On Wed, Sep 23, 2009 at 03:52:11PM -0700, Ray Van Dolson wrote:
> Hi all;
> 
> In the land'o'shell, I can do something like the following:
> 
>   tar cvf - SrcDir | (cd /dest ; tar xvf -)
> 

Bad form replying to my own post... while I'd still like to know if
this is possible to do with the tarfile class, it seems like using
subprocess.Popen() and calling tar from there with stdout set to PIPE
is probably the way to go.

I think this will result in the fastest way to copy files around.
Sounds like shutil.copytree() may not be all that robust (and probably
not very fast) in my version of Python (2.4.3 on RHEL5).

Still open to creative suggestions... :)

Ray



More information about the Python-list mailing list