how to take tar backup of the contents of a file


 
Thread Tools Search this Thread
Operating Systems AIX how to take tar backup of the contents of a file
# 1  
Old 07-30-2009
how to take tar backup of the contents of a file

Hi
I have a file named files.2.backup which holds the location of some directory and file i,e
Code:
$ cat files.2.backup
/d01/app/oracle/product/7.3.2/dbs/fortest_syst_01.dbf
/d01/app/oracle/product/7.3.2/dbs/fortest_temp_01.dbf
/d01/app/oracle/product/7.3.2/dbs/fortestdata_01.dbf
/d01/app/oracle/product/7.3.2/dbs/ora_control5
/d01/app/oracle/product/7.3.2/dbs/ora_control6
/d01/app/oracle/product/7.3.2/dbs/fortest_redo_01.dbf
/d01/app/oracle/product/7.3.2/dbs/fortest_redo_02.dbf
/d01/app/oracle/product/7.3.2/dbs/fortest_redo_03.dbf
/d01/app/oracle/product/7.3.2/network/admin
/d01/app/oracle/product/7.3.2/dbs/initfortest.ora

How can I take tar backup all of these files and directory..
I am using AIX4.3 and my UNIX knowledge is not so high....


Could you please help me to complete my task..


Thanks
suman
# 2  
Old 07-30-2009
Hi.

Use the -L option.

i.e.
Code:
tar cvf myArchive.tar -L files.2.backup

The man page has more information and examples:
Code:
man tar

# 3  
Old 07-30-2009
Open the man page for tar
Code:
man tar

When the man page is open, type shift+7, ie. a slash / and then enter the search string:
Examples

You will find plenty examples how to use tar.
# 4  
Old 07-30-2009
thanks for reply
i have tried
Code:
tar cvf files2backup.tar -L files.2.backup

and when i issue
Code:
tar -xvf files2backup.tar

i got back the original files.2.backup

but i want to backup those files and directory mentioned in the files.2.backup
i,e, in the 9th line of files.2.backup, i mentioned /d01/app/oracle/product/7.3.2/network/admin . this is directory path and there are many files in that directory. I to backup all these files that is the complete directory
# 5  
Old 07-30-2009
You can also use for loop as shown below.....

for i in ` cat files.2.backup`
do
tar -cvf $i
done


HTH
# 6  
Old 07-30-2009
Try
Code:
tar -cvRf files2backup.tar files.2.backup

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX Tar file backup

I want to create a tar file that backup all my recent work. I have no idea how Tar file works and I am new to Unix Please help (1 Reply)
Discussion started by: GGBEASTBOI
1 Replies

2. UNIX for Dummies Questions & Answers

Listing contents of .tar.gz files

Hi All, I would like to know couple of ways to list the content available in tar and gzipped file without extracting. i.e., I would like to display the contents of test.tar.gz without extracting. Note :: please suggest a command other that tar -ztvf (9 Replies)
Discussion started by: Girish19
9 Replies

3. Shell Programming and Scripting

Extract contents of tar ball without extracting files

Hi, I'm using a tar command tar -xOvf /home/mytar.tar My intention is to extract data in files which are inside various directories, without extracting files to the disk. Is this the best way to achieve it? Thanks, Chetan (3 Replies)
Discussion started by: chetan.c
3 Replies

4. Shell Programming and Scripting

How to grep the contents inside a tar file

Hi All I have searched the possibility of this options everywhere but am unable to find it in any forum. I have a tar file inside which there are n number of files and i dont know them. I need to grep a word inside the tar file and need to know in which file the word resides. > cat a... (2 Replies)
Discussion started by: Whiteboard
2 Replies

5. Solaris

Listing Contents of tar.gz file

Hi fellows, Can you please share any command with which I can list down the file names inside a tar.gz file. I have tried with these possibilities but in vain. bash-3.00$ tar -ztvf file.tar.gz tar: z: unknown function modifier bash-3.00$ tar ztvf file.tar.gz tar: z: unknown function... (1 Reply)
Discussion started by: Zaib
1 Replies

6. Shell Programming and Scripting

File Backup - TAR help

Hi, Another rookie here. I have a script I am developing to backup files from various directories onto a windows machine. Script description: - mv files from various directories - tar all files in that directory - export to windows server for safe keeping, external backups. The... (5 Replies)
Discussion started by: mcclunyboy
5 Replies

7. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

8. Shell Programming and Scripting

Elegant gunzip of tar Contents

I am faced with a situation where I have directories of gunzipped contents bundled into a tar file. It might look something like this. x coop/batch/bin/ha90x20.gz, 632641 bytes, 1236 tape blocks x coop/batch/icm/HA90X20.icm.gz, 1821 bytes, 4 tape blocks x coop/batch/aeenv.gz, 4117 bytes, 9 tape... (2 Replies)
Discussion started by: scotbuff
2 Replies

9. Filesystems, Disks and Memory

Tar file from Linux server to PC for backup

I have a Linux email server, I want to backup all /home /var... by tar command and copy to my PC for backup everyweek. The Linux serve rhave ftp function. Is there any program to help backup my file? any url welcome many thank. (8 Replies)
Discussion started by: zp523444
8 Replies

10. Shell Programming and Scripting

How to exclude file in tar backup?

I am taking a backup of area with the following command:- tar -cf -./* |/usr/contrin/bin/gzip >xxx.tar.gz. The area contains following files :- xxxx yyyy zzzzz asdaD DASdD WQWEE I want to backup all the files except yyyy from the following area. I checked manual page of tar but I... (2 Replies)
Discussion started by: kamlesh_p
2 Replies
Login or Register to Ask a Question