[CentOS] Rsync and full path of filenames

nate centos at linuxpowered.net
Wed Oct 28 17:31:11 UTC 2009

Niki Kovacs wrote:
> Hi,
> rsync -av /etc/httpd/conf/httpd.conf destinationfolder/
> I get something like :
> destinationfolder/httpd.conf

This is normal because your copying a file not a tree

> QUESTION (at last) : is there a way rsync can somehow add the full file
> path, so the end result is more like :

Copy the tree and use something like includes or excludes or
even the files-from option to specifically include the files you
want to copy.


[natea at us-cfe002:/etc]$ cat /tmp/files.txt
[natea at us-cfe002:/etc]$

[natea at us-cfe002:/etc]$ rsync -av --files-from=/tmp/files.txt / /tmp/
building file list ... done

sent 34853 bytes  received 40 bytes  69786.00 bytes/sec
total size is 34704  speedup is 0.99
[natea at us-cfe002:/etc]$ ls -ltr /tmp/etc/httpd/conf/httpd.conf
-rw-r--r--  1 natea natea 34704 Nov 18  2007 /tmp/etc/httpd/conf/httpd.conf

use the -n option with rsync for testing, to have it only show you
what it would do rather than doing it.


More information about the CentOS mailing list