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.
On Thu, Oct 06, 2016 at 03:08:53PM -0000, jerome.yanga@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.
On Thu, Oct 6, 2016 at 5:57 PM, Richard W.M. Jones rjones@redhat.com wrote:
On Thu, Oct 06, 2016 at 03:08:53PM -0000, jerome.yanga@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 _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org
Try this...
mkdir dir2
add it to archive via built-in archive software, in my case archive manager for gnome. You should have both dir1 and dir2 in archive. Right click dir1 and chose cut. Navigate into dir2 and paste.
I created directory "test1" and then:
touch test1/file1 touch test1/file2
creating two files in test1. In the file manager I chose to "create archive" then did the above successfully thus restructuring the archive without extraction. Mileage may vary. HTH.
-- Fred