neversaint neversaint - 4 months ago 10
Linux Question

Tar archiving that takes input from a list of files

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

Assuming GNU tar (as this is Linux), the -T or --files-from option is what you want.

Comments