I need to store a large number of files (> 100,000) in a tar archive and have run into the error: /bin/sh: /bin/tar: cannot execute [Arg list too long].
Are there limits with UNIX Solaris tar or GNU tar? Or, is this a ZFS issue? I am running Solaris 11.3 with ZFS.
Best Answer
This is not a limitation of tar. You are exceeding the maximum size of arguments that can be passed to a program. If the list of file names is available in a file, then you can use GNU tar's
-T
option:Tar can also receive the file list from standard input by using
-
as the file name. For example, if you want to create an archive containing all files and subdirectories ofmydir
, you can pass the output offind
to tar: