Using external filter on the server

Mark mark0x01 at gmail.com
Wed Apr 29 03:52:35 MDT 2015


Searching the mail list archives, I found this old link 
[https://bugzilla.samba.org/show_bug.cgi?id=2423] with an example of how 
to use an external script with filter to select files by date.

It looks like it could do exactly what I need, which is only match files 
less than 3 days old, but it doesn't seem to work.

I have added the filter to the rsyncd.conf on the source server, which 
receives the native client connection over a network.

	filter='-!| newer-filter mm/dd/yy'

This is the script as suggested.
 From the cmd line it returns a line of 0's or 1's if I pipe an 'ls' of 
the folder to it, so seems ok.

--------------------------------------------------------------
#!/bin/bash
# We convert times to seconds since the Epoch so
# we can compare them with [ -gt ].
cutoff_time=$(date +%s -d "$1")
while IFS='' read fname; do
     # Compare file's mtime to cutoff time
     if [ $(stat --format=%Y $fname) -gt $cutoff_time ]; then
         echo -n 1
     else
         echo -n 0
     fi
done
--------------------------------------------------------------

However, the rsync log output shows the desired files are parsed, but 
none are never selected for sending.


Has anyone a working example of using an external script as a Filter 
source ?


Thanks in advance,
Mark.



More information about the rsync mailing list