On Thu, Oct 06, 2016 at 03:08:53PM -0000, jerome.yanga(a)gmail.com wrote:
Is there a way to change the folder structure inside a tar file
without extracting it to disk first?
For example, I have the following file/folder structure in a tar file, test.tar.
dir1/
dir1/file1
dir1/file2
I would like the contents to be modified to.
dir2/dir1/
dir2/dir1/file1
dir2/dir1/file2
Thank you in advance.
libarchive can probably do this kind of thing. Some coding required
however ...
By far the easiest way would be to accept that you need to unpack it
to disk.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org