0

I'm parsing rsync's output and would like to be certain that I know what input I get. I'm wondering whether to use --out-format '%i %n' or --out-format '%i %f', but what's the difference, apart from the trailing slash on directories?

man rsyncd.conf says under log format:

  • %n the filename (short form; trailing "/" on dir)
  • %f the filename (long form on sender; no trailing "/")

– what's the difference between "short form" and "long form"?

1 Answer 1

1

https://git.samba.org/?p=rsync.git;a=blob;f=log.c;h=b145ee1d893904835cd3c9276ec7c9c6fbaf13f3;hb=HEAD#l589 seems to be the source.

%n is the simpler version, and just prints the filename relative to the destination, so if you call rsync with source argument a/b, then it will print e.g. b/somefile.

%f prints the filename relative to the source if am_sender, so if the source argument was a/b, it will print e.g. a/b/somefile. If am_daemon, it seems to prepend the module name, though I've never tried that. It additionally calls clean_fname, which seems to remove superfluous double slashes or dots from the source (e.g. if you call it with a//./b it still prints a/b/somefile).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .