> And then it doesn't give you a good progress bar
rsync --progress
> let you resume interrupted operations rsync --partial
...or enable both at the same time with rsync -P(These features only available on samba.org's original rsync, and not OpenBSD openrsync[1], but I don't think openrsync has seen a widespread use yet, as it's still pretty new)
If you use rsync --partial it has to rescan the source and destination directories again. All it does is let you resume transfers, and for some of us, transfers are not the slow part.
In particular, when there's a hierarchy on a remote machine that I want to sync to a partially-up-to-date hierarchy on a local machine, the required rsync command is a one-liner and it's very fast because it uses a diff.
Incidentally, the "tar" man page is not exactly a model of simplicity itself.
That's exactly my point, isn't it? rsync does several different things, depending on how you invoke it, rather than being a UNIXy tool that does one thing well. Because the single tool does everything, you can't easily swap out different parts of it, and the single tool takes a hundred options.
https://gist.github.com/jasom/ecdec7767b5f774cd24aebba3c2ba3...
It is hard to emulate what rsync does with archive mode enabled, which speeds up transfers, so tar isn't exactly a replacement for rsync.
There are better ways to show progress, for example using the flag `--info=progress2`. It doesn't behave well in automated scripts though
Keep in mind however that the format of --progress has changed in the past. Depending on your version of rsync it may or may not insert thousand seperating commas into the number of bytes written, e.g. 2,384,908 vs 2384908. The former can be supressed with --no-h, an option not available on at least some older versions of rsync that default to no commas.
Archive mode is what tar does by default. It is just an alias for -rlptgoD. How does this speed up transfers? Are you thinking of something else?
So I use rsync, which offers, as a core feature, resuming interrupted operation.
Edit: --progress also tells you how many files rsync has been told to sync, and of those, how many are remaining.
2384908 100% 57.52MB/s 0:00:00 (xfr#1, to-chk=7/11)
e.g. transfer #1 out of 11 files or directories to check, with 7 remaining.(I say this as somebody who's written a GUI wrapper around rsync to, among other things, implement my own progress bar. So I agree with the general principle of writing porcelain around rsync.) (Incidentally --progress has actually changed in a way that breaks (my) scripts in the past; the version that ships with MacOS and the latest version exhibit different behavior by default. It would be nice if there was a better way. If rsync followed the ffmpeg model of foremost being a library with a standard command line interface, I think that could be ideal.)
Rsync is certainly not simple. It certainly doesn't do one thing. It's "extraordinarily versatile" to the point of madness. Here's what it does:
- Copies files from A to B
- Mirrors directories
- Computes diffs
- Applies patches
- Evaluates filters
- Runs as a daemon
- Runs over various remote shells
- Applies filters to filenames
And then it doesn't give you a good progress bar or let you resume interrupted operations, or gather errors at the end. I think this is a good case where the tool may have grown too large and unwieldy, and it may be better to replace it with an API or a collection of small, UNIX-like tools. For example, if I just want to copy files from point A to B, I can do this:
If I want a progress bar, I can use pv, Usually I find this easier to use than rsync.