Tar archiving that takes input from a list of files
You can also pipe in the file names which might be useful:
find /path/to/files -name \*.txt | tar -cvf allfiles.tar -T -
Some versions of tar, for example, the default versions on HP-UX (I tested 11.11 and 11.31), do not include a command line option to specify a file list, so a decent work-around is to do this:
tar cvf allfiles.tar $(cat mylist.txt)
Yes:
tar -cvf allfiles.tar -T mylist.txt
Assuming GNU tar (as this is Linux), the -T
or --files-from
option is what you want.