Tar list of files resulting from command

153 Views Asked by At

I have a folder with 200k pdf files and want to tar them. Which of the following solutions would be better? I suspect the command substitution might run into problems with the huge number of files because of command line length limitations.

Process Substitution

tar -cf out.tar -T <(compgen -G '*.pdf')

Command Substitution (Might break command length limitations?)

tar -cf out.tar `compgen -G '*.pdf'`
1

There are 1 best solutions below

3
Karl-Marx On

I tested.

Process Substitution woks, Command Substitution breaks due to argument list length.

I also tested with tar --append with both find and xargs. The results suggest that append is much slower.