You can do something like

"rsync OPTIONS --rsync-path="find /root-dir/ -mtime +14 -delete ; rsync"
SRC DEST"

although, to be safe you'll probably want something like:

"rsync OPTIONS --rsync-path="find /root-dir/ -type f -mtime +14 -delete
; rsync" --prune-empty-dirs SRC DEST"

I'm not sure whether or not find would delete a directory that's not
empty, but this the safe bet.

Thomas von Eyben wrote:
> Hi list,
>
> I have been reading MAN pages and listarchives, but not found the
> answer to my question though I am sure it must be possible to acheive
> my wish.
>
> I wish to use rsync to create a backup BUT only keep the files for a
> limited period of time, EG two weeks.
> I have not yet been able to figure out how to do this inside rsync
> (while the backup is being performed) and my understanding of the
> "--delete" flag is not for this wish.
>
> My plan is - unless I find out that it indeed is possible with rsync -
> to make a cronjob removing files older than X in the folder containing
> the backups…
>
> BR,
>
> Thomas von Eyben

--
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