Is it valid to do this:
{
tar -c dir1
tar -c dir2
} | cat > file.tar
Is the resulting file.tar a valid tar ball?
If not, how can I concatenate tar balls on the fly?
|
|
|
Yes, with a slight modification of your method. tar supports concatenating multiple tar files together.... remember its history... it's a TAPE-ARCHIVE.... it's a data-stream, reminiscent of a spool of tape whizzing past the read/write head.... it's just blocks of data to the tar program... From what my testing shows, you kinda have to have at least ONE tar file somewhere...
From this point... you can either add more files, or append another tar (or multiple...)
Everything gets smushed into 'one.tar' in this example... if you use the 'rf', it appends new files to the given tar (one.tar here), whereas if you use the Af, it appends one or more tar files onto the original tar file (urk! recursive tar! sticky!) As always, the man pages are your friends. (slow, faintly glowing phosporusly green friends... but friends) |
|||
|
|
|
You cannot just concatenate tarballs like this, it will not behave as you would expect. You can check the contents of the tarball using:
This would only print the contents of
The manual is available at http://www.gnu.org/software/tar/manual/ |
|||
|
|