zip files using bzip2

Hi all,

Say I've got a file /tmp/tempfile.txt which contains a list of files with full path.

Now I would wish to take all filenames in that tempfile as arguments and zip them in a single archived file. So how could I archive this?

Seems like I need to use the xargs command?

Thanks

bzip2, and UNIX compressors in general, don't work that way. You'll have to put them in a container like tar to put them in a single file.

Thanks for your reply.

Could you please show me a sample how tar takes arguments (file names with full paths) from a .txt file and zip them in a single file?

Thanks

xargs tar -rcf file.tar < files.txt
bzip2 file.tar

Hi Corona,

Thanks for your advice. I have tried that way but unfortunately only a few of files in that list (files.txt) were zipped? Where are the other files?

Thanks

They should all be inside file.tar.bz2

Did any of the filenames in the list contain spaces?