DO NOT REPLY [Bug 2423] Feature Request: Ability to transfer files newer than date or file. (--newer switch).

samba-bugs at samba.org samba-bugs at samba.org
Fri Jan 5 00:53:03 GMT 2007


https://bugzilla.samba.org/show_bug.cgi?id=2423





------- Comment #7 from hashproduct+rsync at gmail.com  2007-01-04 18:53 MST -------
(In reply to comment #3)
> Actually, that cant work. I dont have the filenames I need to rsync. I'm
> rsyncing from client, not from server.
> 
> The destination is '.' not 'host:/dest/'

You could write a script on the server that pipes the results of the find to
rsync and then specify that script as the --rsync-path.

Roman and Peter, another way to accomplish what you want is to use --update and
have the receiver truncate files it is finished with to zero length instead of
deleting them.  James, I don't know whether this technique accomplishes what
you want.

An alternative to adding --newer is to add a new kind of filter rule that makes
rsync pass file names to a user-specified program, which decides whether they
"match" the rule.  The specifics could be as follows.  A "|" modifier means to
interpret the text of the rule as a command line instead of a filename pattern.
 Rsync runs the command and gives it one filename per line on standard input. 
The command must print a "0" or "1" character for each file to indicate whether
the custom rule matches the file.  For example, the following option would have
the same effect as `--newer=TIME':

--filter='-!| newer-filter TIME'

where newer-filter is the following script:

#!/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

The "|" modifier would support all non-name-based filters at once and would
have the additional advantage that they could be prioritized anywhere in the
filter list.  One disadvantage is that many rsync daemons would want to refuse
the modifier for security.


-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list