[CentOS] Rsync and full path of filenames

Niki Kovacs contact at kikinovak.net
Wed Oct 28 17:18:40 UTC 2009


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 ?

Any suggestions ?


More information about the CentOS mailing list