Wednesday, July 19, 2006

Linux : Appending a tar file with xargs

Whereas -c switch of tar command creates an archive, -r is used to append files to a tar files. In the following example, xargs keeps on sending htm files as input to the tar command. These files are appended to htm_files.tar.

find . -name "*.htm" | xargs tar rvf htm_files.tar

Usual way of tar -cvf does not work for the above purpose.

1 comment:

Anonymous said...

find . -name "*.htm" -exec tar rvf htm_file.tar {} \;

works as well.