I think you would implement it as a new type of filter rule. similar to 'P'
(preserve) but with a timestamp or delta-time to define what counts as 'recent'
as well as the pattern to match for this rule to apply (which could just be a
wildcard matching anything by default, but could also use the full
pattern-matching capabilities if required).
Have a look at:
the 'make_backups' logic in parse_arguments(), where it adds a 'Preserve'
pattern to match all backup files,
name_is_excluded() and its subfunctions check_filter() and rule_matches() in
exclude.c
You'd need to:
define a new filter-type character ('R' for preserve-Recent?)
define the format of the filter rule for this type e.g. how to represent the
time
add code to parse this new ruletype in rule_matches()
decide how your new option interacts with existing filter rules (higher or
lower precedence, degree of specificity, etc)
add code to insert one or more rules of the new type into the filter list in
appropriate positions
Also:
bump the protocol revision number, because an old rsync wouldn't understand the
new ruletype
decide what to do in the case where one side is using the older protocol (e.g.
treat it as traditional --delete, or don't delete at all?).
So not trivial, but not impossibly difficult, and at least the changes would be
fairly localised.
Hope this helps,
.Dave.
Sent using https://www.zoho.com/mail/
---- On Fri, 22 Mar 2019 06:02:33 +0000 Francois Payette via rsync
<rsync@lists.samba.org> wrote ----
Kudos all that maintain this awesome and enduring piece of software. Awesome
job, many thanks.
I’ve come across a use case that would greatly benefit form a
—delete-older-than <secs> argument. This would behave the same as —delete only
sparing files dest that have a creating time less than <secs> ago. How hard
would this be to implement? Where would I start ?
TIA,
Francois
--
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
--
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