‹ BackHN Continuity

Thread

cp: -r or -R?

125 points · 107 comments · zdw

  1. 5555watch · · focus · HN ↗
    On a somewhat related note, I really hate that in scp -r and -R mean entirely different things.
    1. pluc · · focus · HN ↗
      The worst is when things behave different when you give them `~/somedir` vs `~/somedir/`. I think it's rsync that does that
      1. GrantMoyer · · focus · HN ↗
        I really like this feature of rsync (trailing "/" means copy the directory contents to the dest, no trailing "/" means copy the directory itself). Other tools, like cp, don't have any way at all to say copy the directory contents to the dest, and for those tools the result depends on whether or not the destination already exists and is a directory (you might end up with a duplicate nested directory). Rsync produces the same result whether the destination already exists or not.
        1. 0xpgm · · focus · HN ↗
          Why not let the shell do the expansion of `somedir/*` to refer to the content of the directory instead?
          1. 1718627440 · · focus · HN ↗
            Because then you don't have two parameters anymore and need a marker between source and target arguments.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.