Building simplicidade.org: notes, projects, and occasional rants

Is it just me or rsync is crazy?

Is it just me or rsync include/exclude patters are crazy??

I want a simple thing: specify in the server rsyncd.conf file that we only want to export 3 directories from a specific path.

After battling for 1 hour with this, I settled on this configuration file.

use chroot = yes
read only = yes
uid = nobody
gid = nobody

[files]
path = /my/files/
comment = my important files
filter = + /dir1 + dir1/** + /dir2 + dir2/** + /dir3 + dir3/** - *

Notice the pattern? for each directory, we include the directory itself with /dir and then we include all the files (and subdirectories recursively) with dir/**.

I understand why I have to write it this way. I read the fine manual to reach this configuration, but simple things should be simple, right? It would be nice to see something like this:

use chroot = yes
read only = yes
uid = nobody
gid = nobody

[files]
path = /my/files/
comment = my important files
filter = + /dir1** + /dir2** + /dir3** - *

By the way, before you ask. I also tried two lines, first include = /dir* followed by a exclude = *. It seemed logical to me, but it didn't work.

Anyway, it's working now with the first configuration, but I would like to see a simpler way.

Update: The Gods must be watching… In the latest rsync release, 2.6.7pre1, this is mentioned on the release notes:

  • The include/exclude code now allows a dir/*** directive (with 3 trailing stars) to match both the dir itself as well as all the content below the dir (dir/** would not match the dir).

Thank you!

Technorati Tags: