Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending tar files ?

Status
Not open for further replies.
Apr 2, 2002
25
US
I trying to creat a tar file and the add some files to it.
For some reason I keep over writing the tar file.

what is the command to append to the end of a tar file ?

Thanks
 
Try tar with the -u option. See the man page for details. However, I have heard that this option isn't exactly foolproof. I would recommend appending a new tar archive using the non-rewind tape device (in Solaris, for example, this is /dev/rmt/0cbn, the n meaning no-rewind). Post your syntax if you're still unsure. Cheers.
 
You can't append to a tar file. You would need to untar the file, add your new files to the list and tar them up again.

Alternatively do you mean write a new tar file to the end of a tape ? In this case you need to fast forward the tape to the end of the first file use mt -fsf specifying the no rewind device. Then tar your second file to the tape
 
Is my reading of -u incorrect then? The (Solaris 7) man page says:

" u Update. The named file s are written at the end of the tarfile if they are not already in the tar-file, or if they have been modified since last written to that tarfile. An update can be rather slow. A tarfile created on a 5.x system cannot be updated on a 4.x system. A file created with extended headers must be updated with extended headers (see E flag under Function Modifiers). A file created without extended headers cannot be modified with extended headers."

Admittedly, I've never used it, but presumably such red herrings aren't usual in man pages? Any views or experiences welcome. I know Tony Lawrence tends to recommend one os the 'Supertars' (eg LoneTar) which I understand allow such dynamic adding of files.
 
Sorry I didn't give more details on this post.. my bad !

I was trying to append some files to an exhisting tar file.

The option I was looking for was -r

If you have a file called test.tar and you want to add some files to it I used the options like so....

tar -rf test.tar added_files

this option added the fill called added_files to the test.tar file.
 
Hi,

-u also works on my system (UNIX SunOS).

tar -uf existing.tar file1 file2

You can display the files with

tar -tf existing.tar

to check that it worked

-Tyler
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top