How can I remove the leading path from a tar and retar it in memory?
Solution 1:
You most certainly can create a tar from stdin. Use -
as the source, and pipe whatever you want to tar into it.
http://ss64.com/bash/tar.html
http://www.google.com/search?q=tar+stdin
Solution 2:
The Python tarfile
module supports both stream reading and writing. You can take the result of TarFile.extractfile()
from one tar file and feed it right into TarFile.addfile()
of a second file. Obviously this would require a bit of programming, but it would do as you ask.