bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Problem with multiple archives and --concatenate


From: Tim Kientzle
Subject: Re: [Bug-tar] Problem with multiple archives and --concatenate
Date: Tue, 19 Aug 2008 09:38:43 -0700
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422

Paul Fee wrote:

The documentation for GNU tar suggests that multiple
archives can be appended onto an existing archive.

e.g.
tar --concatenate --file=first.tar append1.tar
append2.tar

If you do this kind of archive manipulation often,
you might find bsdtar's approach to this problem
of interest.  Instead of providing an option to
"concatenate archives", it provides a way to
read entries from one or more existing archives
when creating a new archive.

It does this by recognizing '@archive' as an instruction
to read entries from the specified archive (instead
of treating the archive as a file on disk):

$ tar --version
bsdtar 2.5.5 - libarchive 2.5.5
$ echo start > start
$ echo one > one
$ echo two > two
$ echo three > three
$ tar cf first.tar start
$ tar czf append1.tgz one
$ tar cyf append2.tbz two
$ tar cz --file output.tgz @first.tar  \
   @append1.tgz @append2.tbz three
$ tar tvf output.tgz
-rw-r--r--  0 tim    tim   6 Aug 19 09:20 start
-rw-r--r--  0 tim    tim   4 Aug 19 09:20 one
-rw-r--r--  0 tim    tim   4 Aug 19 09:20 two
-rw-r--r--  0 tim    tim   6 Aug 19 09:20 three

You can combine this with options such as --exclude
and --include to select which entries get carried
through and even use --format to determine the
format of the result:

  tar czf output.tgz --format=pax --exclude=foo/   \
     @one.zip file2 @three.cpio dir4

or use stdio to create an archive-conversion filter:

  tar czf - --include=foo/ --format=ustar @-

There are some limits, of course.  In particular,
converting between dissimilar formats sometimes breaks
hardlinks.

This approach is necessarily a little slower than the
GNU tar --concatenate option, but it gives you a lot
more flexibility.  I thought the folks on this list
might find the approach worth considering.

Cheers,

Tim Kientzle




reply via email to

[Prev in Thread] Current Thread [Next in Thread]