Re: Rsync and full path of filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Wed, Oct 28, 2009 at 12:18 PM, Niki Kovacs <contact@xxxxxxxxxxxxx> wrote:
> Hi,
>
> I have a bit of a tricky question about rsync.
>
> Let's say I want to backup a bunch of configuration files with rsync, in
> a script.
>
> What I don't want to do : a full snapshot of /etc.
> What I want to do : backup only those files I need, in an otherwise
> empty directory tree.
>
> In my script, I'd begin with a list of the files I effectively want to
> backup. Something like :
>
> /etc/httpd/conf/httpd.conf
> /etc/httpd/vhosts.d/*.conf
> /etc/exports
>
> Then I'd have some other files in /usr/local/bin and /usr/local/sbin,
> which I would like to backup too.
>
> Instead of a puzzling explanation, let me just show you how I would like
> my resulting backup to look like, so you get the idea :
>
> etc/
> `-- httpd
>     |-- conf
>     |   `-- httpd.conf
>     `-- vhosts.d
>         |-- site1.conf
>         |-- site2.conf
>         `-- site3.conf
>
> usr/
> `-- local
>     |-- bin
>     |   |-- script1.sh
>     |   `-- script2.sh
>     |-- sbin
>     |-- sbinscript3.sh
>     `-- sbinscript4.sh
>
> Now if I do something like this :
>
> rsync -av /etc/httpd/conf/httpd.conf destinationfolder/
>
> I get something like :
>
> destinationfolder/httpd.conf
>
> QUESTION (at last) : is there a way rsync can somehow add the full file
> path, so the end result is more like :
>
> destinationfolder/etc/httpd/conf/httpd.conf ?

Here's how we do it.

cd /
rsync -avR etc/httpd/conf/httpd.conf /destinationfolder

Note that the lack of leading slash on the source.

--
Jeff
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux