‹ BackHN Continuity

Thread

cp: -r or -R?

126 points · 110 comments · zdw

  1. pasc1878 · · focus · HN ↗
    Use rsync instead
    1. 5555watch · · focus · HN ↗
      In my minimal attempts to use rsync, I always find examples where they always use a ton of flags alongside the locations. I'm not gonna learn those flags if cp can do it intuitively and with minimal extra commands. Maybe it's just me.
      1. CoastalCoder · · focus · HN ↗
        Not just you.

        Also, I always have this vague fear that I'll rsync in the wrong direction, or accidentally blow away unrelated files in rsync's efforts to fully synchronize two directories (can't remember if this is a valid concern).

        I'm sure these concerns would go away if I used it regularly, but I just don't. ‘cp' or ’scp’ almost always meet my needs.

        Kinda like the way people are probably right that I should learn to use ’awk’, but I just can't muster the motivation.

        1. toast0 · · focus · HN ↗
          > Also, I always have this vague fear that I'll rsync in the wrong direction

          It's the same direction as cp/scp ... You could easily do it wrong, but you must be afraid to do anything other than maybe cat < source > dest because that's clear?

          > or accidentally blow away unrelated files in rsync's efforts to fully synchronize two directories (can't remember if this is a valid concern).

          I think you need --delete for this. As I recall, it's sometimes more tricky to get it to delete the files you wanted it to delete and you're more likely to end up with extra files than removing files you didn't intend to.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.