I have a lot of filenames that listed in a .txt file called to_be_archived_files.txt
, and its content is as:
~/Documents/dir1/a.html
~/Documents/dir1/b.html
~/Documents/dir1/c/1.html
How do I add all of them into a archive.tar.gz
by tar?
I want something like:
tar czf archive.tar.gz -FROM-FILELIST=to_be_archived_files.zip
How can I achieve that?
Best Answer
Use the
-T
option:Note that it doesn't work with
~
as alias for home directory, you need to specify the folder explicitly.