Tuesday, 29 April 2014

Append files to an Archive TAR file


The simplest way to append the files into existing archive is the “--append” or “-r” operation using tar command.

Syntax:
tar –rvf <Tar Archived File>  <filename>
OR
tar –append –file=< Tar Archived File>  <filename>

Example1:
Here we are adding filename “five” into archive file “test.tar”.

[root@mail01 jitendrakumar]# tar -rvf test.tar five
five
 [root@mail01 jitendrakumar]# tar -tvf test.tar
-rw-r--r-- root/root         0 2014-04-29 10:58 two
-rw-r--r-- root/root         0 2014-04-29 10:58 three
-rw-r--r-- root/root         0 2014-04-29 10:58 foure
-rw-r--r-- root/root         0 2014-04-29 10:58 one
-rw-r--r-- root/root         0 2014-04-29 10:59 five

Example2:
 Here we are adding filename “six” into archive file “test.tar”.

[root@mail01 jitendrakumar]# tar --append --file=test.tar six
[root@mail01 jitendrakumar]# tar -tvf test.tar
-rw-r--r-- root/root         0 2014-04-29 10:58 two
-rw-r--r-- root/root         0 2014-04-29 10:58 three
-rw-r--r-- root/root         0 2014-04-29 10:58 foure
-rw-r--r-- root/root         0 2014-04-29 10:58 one
-rw-r--r-- root/root         0 2014-04-29 10:59 five
-rw-r--r-- root/root         0 2014-04-29 11:06 six



No comments:

Post a Comment