[afnog] tar: Concatenate / Create from STDIN?

Alan Barrett apb at cequrux.com
Thu Mar 2 11:12:19 EAT 2006


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.

--apb (Alan Barrett)



More information about the afnog mailing list