[CentOS] Rsync and full path of filenames
jlar310 at gmail.com
Wed Oct 28 18:32:10 UTC 2009
On Wed, Oct 28, 2009 at 12:18 PM, Niki Kovacs <contact at kikinovak.net> wrote:
> 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 :
> 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 :
> `-- httpd
> |-- conf
> | `-- httpd.conf
> `-- vhosts.d
> |-- site1.conf
> |-- site2.conf
> `-- site3.conf
> `-- 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 :
> 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.
rsync -avR etc/httpd/conf/httpd.conf /destinationfolder
Note that the lack of leading slash on the source.
More information about the CentOS