1. 9
  1.  

  2. 3

    I, for one, will keep using scp. Rsync’s interface is too different, with a lot of subtle differences which constantly catches me off guard.

    When was, for example, the last time a non-rsync tool cared about whether you included the trailing slash or not for a path to a directory on a GNU system? Why did rsync decide to completely break with the convention? For most people, I bet the behavior of rsyncing directories mostly depends on whether their tab completion happens to include a trailing slash or not.

    1. 1

      Why did rsync decide to completely break with the convention?

      What convention? It follows the SUS/Posix convention, try mv’ing a file to dir or dir/ and note the difference. dir/ is the same as dir/. and implies something different. Its also to handle cases where symlinks may be present to return ENOTDIR.

      Ref: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13 https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_13 https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap03.html#tag_21_03_00_75

      1. 4

        I don’t see a difference between mv <file> <dir> and mv <file> <dir>/? In both cases, <file> is ends up as <dir>/<file>.

        I’m not talking about destinations though, but source. cp foo/ bar and scp foo/ bar will both copy the directory foo to bar such that bar/foo is a directory with the contents of the old foo directory, but rsync foo/ bar will copy all the contents of foo into bar, like cp foo/* bar would do.

        1. 1

          I don’t see a difference between mv and mv /? In both cases, is ends up as /.

          Depends on if something exists or not.

          $ mkdir /tmp/demo
          $ cd !$
          cd /tmp/demo
          $ touch foo
          $ mkdir dir
          $ mv foo bar/
          mv: rename foo to bar/: No such file or directory
          zsh: exit 1     mv foo bar/
          

          Specifying bar/ here indicates there should be a directory to move to. But its not there.

          but rsync foo/ bar will copy all the contents of foo into bar, like cp foo/* bar would do.

          Correct, becuase foo/ is the same as foo/. which means copy the contents of foo/. to the destination. Just as foo without a / indicates you want the directory itself (and contents therein) copied to the destination. That follows cp as well.

          cp foo/ bar and scp foo/ bar will both copy the directory foo to bar such that bar/foo is a directory with the contents of the old foo directory

          You sure about that? Show your cards as thats not how cp works on any unix i’ve used example from my laptop:

          $ mkdir -p input/{a,b}                                                                                                                                                                                    
          $ mkdir output
          $ cp input/. output
          cp: input/. is a directory (not copied).
          zsh: exit 1     cp input/. output
          $ cp -r input/ output
          $ find output
          output
          output/a
          output/b
          $ rm -fr output; mkdir output
          $ cp -r input output
          $ find output
          output
          output/input
          output/input/a
          output/input/b
          
          1. 1

            I don’t know man. All I can say is that rsync works differently from cp and scp and it constantly messes me up. If you’re unhappy with my explanation of how it’s different, I’m sorry.

    2. 1

      I’ve always preferred sftp anyway but I suppose it doesn’t work well for some people’s workflows.

      1. 1

        Is rsync still single threaded?

        1. 2

          Yeah, just like scp.