Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Up: append


4.2.2.1 Appending Files to an Archive

The simplest way to add a file to an already existing archive is the --append (-r) operation, which writes specified files into the archive whether or not they are already among the archived files. When you use --append, you must specify file name arguments, as there is no default. If you specify a file that already exists in the archive, another copy of the file will be added to the end of the archive. As with other operations, the member names of the newly added files will be exactly the same as their names given on the command line. The --verbose (-v) option will print out the names of the files as they are written into the archive.

--append cannot be performed on some tape drives, unfortunately, due to deficiencies in the formats those tape drives use. The archive must be a valid tar archive, or else the results of using this operation will be unpredictable. See Media.

To demonstrate using --append to add a file to an archive, create a file called rock in the practice directory. Make sure you are in the practice directory. Then, run the following tar command to add rock to collection.tar:

     $ tar --append --file=collection.tar rock

If you now use the --list (-t) operation, you will see that rock has been added to the archive:

     $ tar --list --file=collection.tar
     -rw-r--r-- me user     28 1996-10-18 16:31 jazz
     -rw-r--r-- me user     21 1996-09-23 16:44 blues
     -rw-r--r-- me user     20 1996-09-23 16:44 folk
     -rw-r--r-- me user     20 1996-09-23 16:44 rock

 
 
  Published under the terms of the GNU General Public License Design by Interspire