[afnog] tar: Concatenate / Create from STDIN?

Brian Candler B.Candler at pobox.com
Thu Mar 2 14:58:41 EAT 2006


On Thu, Mar 02, 2006 at 10:12:19AM +0200, Alan Barrett wrote:
> On Tue, 28 Feb 2006, Brian Candler wrote:
> > Right question: "I am trying to tar up a large number of files and
> > directories, using 'find' to identify all files and directories changed
> > within the last N days. Unfortunately the number of arguments to tar is too
> > large. As a workaround I am creating separate tar files each containing one
> > file or directory, and then using tar -A to join each piece onto the end of
> > an existing tarfile. Is there a better way to achieve this?"
> 
> Oh, is that the question?  Use "find ... -print0 | pax -w -0 ...",
> assuming that you have a version of find that supports "-print0" and
> a version of pax that supports "-0" (to use nul-terminated file names
> instead of newline-terminated file names).  If your find and/or pax
> doesn't support those options, then use "find ... -print | pax -w ...",
> but bad things will happen if any files have names with embedded newline
> characters.
> 
> Brian's suggestion to use cpio is almost equivalent to my suggestion to
> use pax.

The advantage of pax, I'm told, is that since it's a POSIX-specified
utility, you should just be able to learn it once and use it with exactly
the same command-line syntax on all platforms. But Alan provides a
counter-example: the -0 flag does not exist in FreeBSD 5.4. OTOH, FreeBSD
does support a whole bunch of flags which are not in the POSIX standard.

For me, life is just too short to learn yet another archiving utility :-)

Regards,

Brian.



More information about the afnog mailing list