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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re : tar command - AIX 4.3

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi ! everybody<br><br>I'm new in Unix and I wanted to know on how to do a backup using tar command. For your information, I have a directory which it store a lot of files. But I wanted to backup certain files only whish is total about hundred files. <br>Currently I'm using the below command but it seem not pratical for use it. <br>$ tar -cvf /dev/rmt0 file1 file2 ... .. <br><br>Please help me on this matter<br><br>Thank you in advance<br><br>Liros<br>
 
make sure you're using the korn shell, first line in script should be '#!/usr/bin/ksh'<br><br>put your filenames in a file (files_bu.list say), one filename per line, and run this command:<br><br>tar -cvf /dev/rmt0 $(cat files_bu.list)<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Or you can use find with some criteria.<br><br>tar -cvf /dev/rmt0 $(find . -something_what_selects_your_files )
 
following from Liros by email.<br><font color=blue><br>hai mike !<br><br>I have followed your guide but it seems this command&nbsp;&nbsp;backup the whole directory instead of only those files needed.<br>The command is as follows<br>tar -cvf /dev/rmt0 $(cat backup.txt)<br><br>for your info. the contents of the backup.txt are as follows.<br><br>cd /text/month<br>text1<br>text2<br>text3<br>text4<br>....<br>....<br>text50<br><br>the directory consists of approximately 500 files.<br><br>Kindly revert to my enquiries<br><br>Your cooperation is ulmost appreciated<br><br>Regards,<br><br>Liros<br></font><br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Hi Liros,<br><br>Sorry about that, I obviously didn't make myself very clear.<br><br>Include the <b>full</b> path and name of each file in the backup.txt file <b>or</b> cd to the correct directory before running tar.<br><br>Don't put the cd command in the file backup.txt<br><br>Taking your example above for some file names your file backup.txt should look like this<br><br><FONT FACE=monospace><b><br>/full_path/text/month/text1<br>/full_path/text/month/text2<br>/full_path/text/month/text3<br>/full_path/text/month/text4<br>/full_path/text/month/text5<br>/full_path/text/month/text6<br>/full_path/text/month/text7<br>/full_path/text/month/text8<br>/full_path/text/month/text9<br></font></b> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top