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.

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to