I've only just started trying to use rsync to do some backups from a couple of Linux machines to a Windows server, which runs the rest of the backup system. After a whole lot of reading and experimenting I finally got it all working on one of the Linux machines (Centos), so I copied the script over to the other machine (Debian), edited some paths and tried to run it. Instead of running the way it did on the first machine I get the following result:
building file list ...
1 file to consider
sent 36 bytes received 16 bytes 11.56 bytes/sec
total size is 0 speedup is 0.00
The script in question is:
#! /bin/sh
/usr/bin/rsync \
--progress \
--recursive \
-t \
--delete-excluded \
--filter="- .cpan/***" \
--filter="- include/***" \
--filter="- cache/***" \
--filter="- lib/***" \
--filter="- cvs/***" \
--filter="+ /BayesTraining/***" \
--filter="+ /BogoTraining/***" \
--filter="+ /etc/***" \
--filter="+ /var/***" \
--filter="+ /root/***" \
--filter="+ /boot/***" \
--filter="+ /usr/local/***" \
--filter="+ /home/***" \
--filter="- *" \
/ \
rsync://myserver/targetfolder
It will only start sending files if I remove that last filter parameter but then it sends a whole bunch more than I want.
Where have I stuffed up and what do I need to change? (Before anyone asks, I'm not using rsync over SSH because the Windows server does not yet have an SSH service on it yet. Small steps...)
Edit: rsync --version reveals
Centos: rsync version 2.6.8 protocol version 29
Debian: rsync version 2.6.4 protocol version 29
Solution: Thanks to pavium for pointing out that I have overlooked a crucial part in the man page (reformatted for readability):
a trailing "dir_name/***" will match both the directory (as if "dir_name/"
had been specified) and everything in the directory (as if "dir_name/**"
had been specified). This behavior was added in version 2.6.7.
The solution is to create the following rules for each directory I want included:
--filter="+ /dirname/"
--filter="+ /direname/**"