MacMost Now 233: Using Terminal to Copy Files

Sometimes the Finder can fail you when you want to copy lots of files, like an entire CD or DVD. Learn how to use the Terminal to copy whole volumes with better error handling and reporting.

Comments: 27 Responses to “MacMost Now 233: Using Terminal to Copy Files”

    Homer
    15 years ago

    Thanks for the tip!
    To place volumes/folders/files names; Instead of typing it in the terminal, you can open a Finder window, then locate the desired source (or destination), then simply drag-and-drop the object inside the Terminal window. The complete path will be entered automatically by Unix at the cursor position.

    ouriel
    14 years ago

    Man, you really made my day! I was stuck with my whole itunes library, and no possibility to copy it back to a newly formatted FAT32 external drive. I wish I had found your post earlier. Would have saved me some precious time. You're first in my bookmarks now!

    ShabbaRanks
    14 years ago

    Thanks. I had exactly the same problem with the stupid Finder.

    You da man!

    Prateek
    14 years ago

    You helped me recover over 90 gigs from my external hard drive thank you so much

      Tyler
      14 years ago

      I need to know how to do this :(

    MAx
    14 years ago

    Good God. Finally a clear answer! Where has this video been hiding all my life?

    Tom
    14 years ago

    Thank you! 65GBs of music was painstaking! More people should know about you.

    Garfield
    13 years ago

    This works:
    cp -rpv "/Volumes/Untitled" ./

    But this does not work:
    cp -rpv "/Volumes/Untitled/Documents\ and\ Settings/Grim/My\ Documents " ./

    Note: The path were obtained by dragging the folder into terminal so I know I don't have a type. Any help would be appreciated.

    Thanks

      Jared
      13 years ago

      The forward slashes \ are used to tell the terminal there is a space in the name. Putting the whole path in quotes tells the terminal that the \ are really in the file name, which they are not. So either get rid of the quotes or the forward slashes and it should work just fine.

        sam
        12 years ago

        That's a backslash.

    Pieter C
    13 years ago

    Thank you so much for this tutorial! You really made my day!
    I used your command to copy the entire HDD from my girlfriends MacBook to an external HDD.

    Best regards,
    Pieter

    Kedron
    13 years ago

    I have this running right now in my terminal! Thank you SO much for this quick and easy tutorial! This is JUST what I was hoping to find!!

    A Photog Who Blogs
    13 years ago

    I've been hunting for a mac app to do a better job of copying files, and now I don't need one, and I can feel cool using Terminal!

    A Photog Who Blogs
    13 years ago

    I use it this way to prevent a file from being overwritten at the destination:

    cp -rpn /Volumes/HardDrive/PHOTOS/2010 ./

    also, I learned if you end the directory with a slash, it will only copy the contents, not the actual directory. such as:

    /Volumes/HardDrive/PHOTOS/2010/

    Almost there
    13 years ago

    Well... You got me closer than finder, however, Resource busy messages keep popping up and halting the whole procedure. So much for Terminal bypassing troublesome files.

    mido
    13 years ago

    what is the last button i shoul'd hit???

    mido
    13 years ago

    you are greAAAAAAT MAN thanks a lot

    embroc
    13 years ago

    Hi I tried typing this in cp -rpv "Final cut tutorials" ~/Volumes/"External 1TB" it found the files however said no such file or directory after each one. What did I do wrong? I was moving a folder from my desktop to an external hard drive.

      13 years ago

      That doesn't look right. Why the ~ before the destination? What happens when you just use the Finder to do the copy?

    Joe Mac
    13 years ago

    Great tip- I was having issues copying a large music collection from one external hd (fat32) to another. Your tip and great tutorial worked like a charm. Thank you again for the post!

    Paul O
    12 years ago

    Great tutorial, though I have had a problem. I am trying to copy "Documents" to my external hard drive.

    I use:
    cp -rpv "Volumes/The Hard Drive/Users/myname/Documents" ./

    All my output comes out with "./Documents/*filename*: No such file or directory"
    Then the final line says: "Volumes/The Hard Drive/Users/myname/Documents: unable to copy ACL to ./Documents: Read only file system"

    When I check the contents of the external, nothing has happened

    TheNorthFront
    12 years ago

    Works like a charm where neither Disk Utility or Disk Warrior could be of any use. Started up with install disk and launched Terminal, followed your instructions and Voilá! Copied all my data to a external usb drive after HD failure (invalid node structure). Couldn´t even mount the corrupted HD in target mode. Reinstalled system and activated Time Machine in case of further problems with the drive.

    Merci beaucoup!

    The North Front

    Dmitri
    12 years ago

    Thanks Gary.

    yahyaMIH
    12 years ago

    Hi there all,

    My Hard Disk crashed (OSX Lion) (invalid node & I/O error) and could be repaired even using DWarrior, and this video solution helped me but it only worked with me this way:

    1- booted my mac while pressing on the alt key
    2- choose HD recovery
    3- opened terminal
    4- used the command given in this video and worked like a charm

    a good read that helped me too is ----://aleman.lsnepal.com/2011/10/using-terminal-to-transfer-files-from.html

    hope this helps you all

    Gary, your the man as I recovered all my data thanx to you

    jahaziel
    12 years ago

    if i want to copy all the files from a cd to a usb?

      12 years ago

      Just drag and drop in the Finder. No need to use Terminal for that.

Comments Closed.