4 ms·
At least 9 times out of 10, I end up typing scp instead of rsync, and then regretting it. Rsync makes an effort not to move bytes it doesn't have to and genera
by sevensor 6y ago
At least 9 times out of 10, I end up typing scp instead of rsync, and then regretting it. Rsync makes an effort not to move bytes it doesn't have to and generally saves me a bunch of time. If I'm actually thinking about what I'm doing, I use rsync. Using scp is just muscle memory. I wouldn't miss it.
- stjohnswarts 6y agorsync with the weird / logic is annoying. I prefer scp. I'll use rcp and dig around for the weird incantations if I have something that I need to sync regularly though.
- dylan604 6y agoare you referring to the differing behavior if there is a trailing slash or not? it only takes a couple of times for that mistake to be learned, and then becomes quite the convenient tool when used correctly. it shouldn't be the one thing that prevents you from using a tool on a regular basis though.
- sfink 6y agoThe trailing slash behavior totally makes sense. It only took me a couple of times for me to learn it. Unfortunately, it took only one more time for it to be forgotten, then another few times to be re-learned, then forgotten again, then half-remembered the wrong way, then.... I pretty much have it down now, though. The secret to my success: remembering that the differing behavior applies to the source side only. Trying to work out the matrix of possibilities between source, source/, dest, and dest/ is where I usually got lost, until I finally got it through my head that the destination syntax is irrelevant. Now it makes sense: "foo/bar/" is the directory named "bar"; "foo/bar" is the directory entry within foo/ named "bar". Copying a directory puts its contents on the destination side. Copying a named thing, whether the name refers to a file or directory, puts that name on the destination side.
- recursive 6y agoI've never used rcp or rsync, but your final explanation provides no illumination for me. "foo/bar/" and "foo/bar" are both directories named "bar". Copying a thing puts that thing on the destination side. It still doesn't sound like there's a difference.
- dcassett 6y agofoo/bar/ and foo/bar are not the same if bar is a symbolic link. You can see the difference using 'ls -l'
- hanche 6y agoMy understanding is that "foo/bar/" is considered a short form of "foo/bar/.". Interpreting that forces following the symlink.
- hanche 6y agoI think it makes more sense to say that, for rsync, "foo/bar/" names the contents of the directory, while "foo/bar" names the directory itself. You could perhaps think of "foo/bar/" as a shortcut for "foo/bar/*", except that it matches hidden files as well.
- dylan604 6y agoYeah, that happens to me on anything that gets used, put back up on the shelf, and then pulled back down again after some period of not being used. However, rsync has become the go to tool for getting local content to/from a server.
- perennialmind 6y agoLately I've taken to avoiding that fine point. I find it easier to internalize `foo/bar/.`. Using the self-referential dot this way doesn't carry the same semantics, but the effect is the same and it's a pattern that applies to many tools. rather than consult the manpage yet again. When I want those semantics, I tack on the self-referential dot. `rsync foo/bar/. baz`
- zootboy 6y agoI'm constantly annoyed that normal cp _doesn't_ support the trailing slash distinction. It's so useful.
- elihu 6y agoI just wish that cp and scp were the same; one less inconsistency to have to remember.
- brians 6y agoRsync has surprised me a few times by needing to read everything on the target side. When that includes a few TB of nonlocal disk—whoops!
- schoen 6y agoIt's a clever protocol that optimizes for minimizing network usage. Note that it was written in the 1990s by two Australians! Sometimes this optimization isn't the exact optimization you want. :-)
- marcosdumay 6y agoOn the other hand, rsync just assumes the network is the only slow resource, and use plenty of everything else. What is faster depends a lot on what you are trying to do. Rsync can be several times slower at times.