cp: -r or -R?

(movq.de)

29 points | by zdw 2 days ago

7 comments

  • mkl 10 minutes ago
    -a

    Not sure why you wouldn't want to preserve timestamps, links, etc. by default.

  • pasc1878 6 minutes ago
    Use rsync instead
    • trucks-refinish 1 minute ago
      rsync unfortunately doesn't do relinking at all, so I can't use it as a generic replacement for cp.
  • drhagen 19 minutes ago
    It always seemed like the recursive flag of cp was an implementation detail leaking into the UI. Like, I get that copying a file requires creating more than one inode, but...so? Eventually, graphical OSes agree with me—copy/paste works the same on folders as it does on files.
  • 5555watch 12 minutes ago
    On a somewhat related note, I really hate that in scp -r and -R mean entirely different things.
    • aulin 5 minutes ago
      How about port that is lowercase in ssh and uppercase in scp?
  • bsoqk 55 minutes ago
    It's "ditto", not "dito"
    • Waterluvian 39 minutes ago
      As in the Pokémon, not the Philippines telecom company.
      • Yaqub_W 19 minutes ago
        Much easier to press a key twice than to hunt for é for most people. I get your point though
  • mqus 47 minutes ago
    would you be safe in using --recursive always? (e.g. shell scripts)
    • olowe 36 minutes ago
      There are implementations of cp out in the wild that do not recognise the --recursive flag. OpenBSD was mentioned in the article and there’s also busybox cp https://busybox.net/downloads/BusyBox.html
    • hnfong 21 minutes ago
      Double dash long options are basically a GNU extension. BSD utilities generally don't support them. Apparently macOS does not either (since it's based off of FreeBSD)
      • JdeBP 7 minutes ago
        macOS was based off NextBSD, not FreeBSD.

        And the received wisdom about long options in the BSDs is a quarter of a century out of date. When the BSDs gained a getopt_long() in their C libraries thanks to Klausner and Baron, long options quietly started appearing. This process has been gradually and quietly on-going for the whole of the 21st century.

  • here_to_learn 32 minutes ago
    [dead]