FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 11-08-2008, 11:20 PM
chloe K
 
Default only backup selected files

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




Now with a new friend-happy design! Try the new Yahoo! Canada Messenger_________________________________________ ______
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-09-2008, 02:49 AM
Robert
 
Default only backup selected files

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@mavis ~]$ while read inc ; do echo "including:" $inc ; tar -v -r
$inc -f included.tar ; done < include


Just to be sure....


[rj@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@mavis ~]$



The real challenge here is to compile the "include" file correctly.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-09-2008, 07:04 AM
"Bent Terp"
 
Default only backup selected files

On Sun, Nov 9, 2008 at 4:49 AM, Robert <kerplop@sbcglobal.net> wrote:
> 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

man tar:
-T, --files-from F
get names to extract or create from file F

> 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@mavis ~]$ while read inc ; do echo "including:" $inc ; tar -v -r $inc -f
> included.tar ; done < include

or: tar -jvrc included.tar.bz2 --files-from include

BR Bent
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-09-2008, 02:22 PM
Robert
 
Default only backup selected files

Bent Terp wrote:

On Sun, Nov 9, 2008 at 4:49 AM, Robert <kerplop@sbcglobal.net> wrote:


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



man tar:
-T, --files-from F
get names to extract or create from file F


Yes, I overlooked that option, as I imagine the OP did.

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@mavis ~]$ while read inc ; do echo "including:" $inc ; tar -v -r $inc -f
included.tar ; done < include



or: tar -jvrc included.tar.bz2 --files-from include


Almost....
1. Options "r" and "c" are mutually exclusive.
tar: You may not specify more than one `-Acdtrux' option
Try `tar --help' or `tar --usage' for more information.
2. Without the "f" option, output goes to std out
This works:

[rj@mavis ~]$ tar -jvcf included.tar.bz2 --files-from include
tar: Removing leading `/' from member names
/bin/gawk
/etc/fstab
/etc/resolv.conf
[rj@mavis ~]$

I hope the OP has followed this far without giving up on our combined
blunders. :-(




BR Bent


KRS Robert
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-09-2008, 10:55 PM
chloe K
 
Default only backup selected files

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@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@mavis ~]$ while read inc ; do echo "including:" $inc ; tar -v -r
$inc -f included.tar ; done < include

Just to be sure....


[rj@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@mavis ~]$


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



All new Yahoo! Mail - Get a sneak peak at messages with a handy reading pane._____________________________________________ __
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 01:38 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org