So if I had a cp -v operation fail, is the last file name it printed out the last successful file copy, or is it the failed partially copied file? If you had to ensure all files are copied correctly without overwriting anything, would deleting the last filename that was printed from the destination folder delete the partially copied file that the operation failed on?

  • yuli [she/her]@hexbear.net
    link
    fedilink
    English
    arrow-up
    6
    ·
    10 months ago

    skimming through coreutils’ copy.c, emit_verbose is called on line 2627 while copy_reg is called on line 3103 (in the implementation of copy_internal). at least on my machine, touch /tmp/foo && cp -v /tmp/{foo,bar/} returns an error after printing the verbose output.

    • flux@beehaw.org
      link
      fedilink
      arrow-up
      1
      ·
      10 months ago

      Another way to check is to

      strace cp testfile testfile2
      

      and the sequence in which the message is printed and operations performed can be studied.

      It’s perhaps a lot to read, but linux tracing tools are worth learning!