R
Ray Van Dolson
Hi all;
In the land'o'shell, I can do something like the following:
tar cvf - SrcDir | (cd /dest ; tar xvf -)
I'd like to learn the "Python" way to reproduce the above. Obviously I
could use the subprocess module and just call that exact command above,
but is there a way to do this with the tarfile module?
I realize I can use a StringIO object as the fileobj param then do the
extraction with the same StringIO object... but that's obviously not
the same as doing this all via a pipe as in the shell command.
I could see doing it with a fifo of some sort and having a consumer
process running that reads from the fifo and extracts with the tarfile
command as well... but that sounds overly complex.
I'd like to learn how to achieve this purely for curiosity's sake. I
realize that while the shell tar command is one of the faster ways to
recursively copy file trees around, there might be better ways to do
this from within python..
Thanks,
Ray
In the land'o'shell, I can do something like the following:
tar cvf - SrcDir | (cd /dest ; tar xvf -)
I'd like to learn the "Python" way to reproduce the above. Obviously I
could use the subprocess module and just call that exact command above,
but is there a way to do this with the tarfile module?
I realize I can use a StringIO object as the fileobj param then do the
extraction with the same StringIO object... but that's obviously not
the same as doing this all via a pipe as in the shell command.
I could see doing it with a fifo of some sort and having a consumer
process running that reads from the fifo and extracts with the tarfile
command as well... but that sounds overly complex.
I'd like to learn how to achieve this purely for curiosity's sake. I
realize that while the shell tar command is one of the faster ways to
recursively copy file trees around, there might be better ways to do
this from within python..
Thanks,
Ray