Tar archiving that takes input from a list of files

neversaint picture neversaint · Nov 7, 2011 · Viewed 149.7k times · Source

I have a file that contain list of files I want to archive with tar. Let's call it mylist.txt

It contains:

file1.txt
file2.txt
...
file10.txt

Is there a way I can issue TAR command that takes mylist.txt as input? Something like

tar -cvf allfiles.tar -[someoption?] mylist.txt

So that it is similar as if I issue this command:

tar -cvf allfiles.tar file1.txt file2.txt file10.txt 

Answer

Martin York picture Martin York · Nov 7, 2011

Yes:

tar -cvf allfiles.tar -T mylist.txt