On Sat, Jan 28, 2023 at 1:22 AM Michael Homscheidt wrote:

> I use rsync with the option --out-format '%o %n‘ but want to have the
> contents of the mesages to be overwritten.

You can't make rsync do that directly, but you can filter the output.  For
instance, the following python3 script runs rsync with an --out-format that
starts with "<>" and filters the combined stdout + stderr output, putting
repeated "<>" lines over the top of each other (using ANSII reverse-index &
clear-to-EOL escape sequences). It also allows error/info lines to remain
visible: they do not overwrite the prior merged line and a new merged line
starts below it. If a line is too long to fit on a single terminal line
then there will be some downward movement, but that could be improved
should you desire to do so.

Name this script something like "solo-rsync":

import sys, subprocess
                                                    rsync =
        ['rsync', '--outbuf=line',
            '--out-format=<>%o %n',
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
folding = False
for line in rsync.stdout:
    if line.startswith('<>'):
        if folding:
            print("\033[A" + line[2:].rstrip("\n") + "\033[K")
            print(line[2:], end='')
            folding = True
        print(line, end='')
        folding = False

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