[CentOS] only backup selected files

chloe K chloekcy2000 at yahoo.ca
Sun Nov 9 23:55:57 UTC 2008


Thank you.
   
  How about untar? 
  I am using -T 
  tar cvf file.tar -T file.txt
   
  inside file.txt, 
  eg:
  /var/www/html/version/abc.html
  /var/www/html/version/image/abc.jpg
   
  how can I untar those files into /var/www/html instead of /var/www/html/version
   
  Thank you again

Robert <kerplop at sbcglobal.net> wrote:
  

chloe K wrote:
> Hi
> 
> I have number of selected files to backup and it is also in different 
> folders
> 
> How can I make it easy?
> 
> 
> eg:
> 
> tar zcvf select-file.tar.gz from selected file or tar zcvf 
> select-file.tar.gz (from selected files in file.txt)?
> 
> Thank you for your help
I'm sure there will be other ideas but in the absence of an "include 
these files" file option, you could employ a simple loop to append the 
files in a list to a tar archive. For example, if you had a file named 
"include" with these 3 records

/bin/gawk
/etc/fstab
/etc/resolv.conf

This would cause the 3 files to be archived as "included.tar".
[rj at mavis ~]$ while read inc ; do echo "including:" $inc ; tar -v -r 
$inc -f included.tar ; done < include

Just to be sure....


[rj at mavis ~]$ tar -tvf included.tar
-rwxr-xr-x root/root 320416 2007-03-14 09:48:15 bin/gawk
-rw-r--r-- root/root 874 2008-09-23 09:53:40 etc/fstab
-rw-r--r-- root/root 135 2008-08-21 21:18:43 etc/resolv.conf
[rj at mavis ~]$ 


The real challenge here is to compile the "include" file correctly.
_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos


       
---------------------------------
All new Yahoo! Mail - Get a sneak peak at messages with a handy reading pane.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20081109/06202bb8/attachment.htm


More information about the CentOS mailing list