tar frustration (was Re: relative pathname question!)

Richard A. O'Keefe ok at quintus.uucp
Mon Aug 15 07:05:02 AEST 1988


In article <7056 at conexch.UUCP> root at conexch.UUCP (Larry Dighera) writes:
>This is so simple that it makes me feel like I don't understand the problem.
>If you want tar to take the names of the files it is to put into the archive
>from a file which contains the names of the files, just do this:
>
>	tar cvf /dev/whatever `cat file_of_names`
>
If I have understood correctly, the original problem is a very simple
one: THERE IS A LIMIT ON THE SIZE OF THE COMMAND-LINE ARGUMENTS.
A common figure for this limit is about ten thousand characters
(look for NCARGS in <sys/param.h>).
Now, suppose I want to put 200 files on a tape, each of which has
a (relative) path name amouting to some 100 characters.  OH DEAR.

The problem never was TYPING the file names in the command, the problem
was that if you have a lot of files to archive, the command line just
gets too big to be accepted as a command.  (I have run into this several
times with `echo */*` and the like.)

For many UNIX utilities, this is not a problem, because having many
file names in one command is only a convenience anyway (e.g. *grep,
awk, sed, sometimes wc, ...) and you can use xargs(1) to get the
desired effect -- though that has some weird limits of its own -- but
tar is different.  With some drives you *can't* add to the end of a tape.

As someone else pointed out, the answer is to use John Gilmore's PDtar,
which amongst many other neat things has a '-T' option for reading names
from a file.



More information about the Comp.unix.questions mailing list