Total Newbie question about file copying in terminal

Discussion in 'macOS' started by Robsa, Mar 18, 2010.

  1. Robsa macrumors newbie

    Joined:
    Feb 1, 2009
    #1
    Hi guys

    I am a recent mac convert (and loving it... finally! I think its the move to Unix-framework that has changed my opinion of the mac OS) and have just bought a MyBookWorld network drive to dump all my media on which is currently on my macbook unibody.

    Ok, so I know its a pretty crappy product... copying is agonizingly sloooow and is always falling over.

    I have been trying to enter terminal and use the cp command to copy, hoping I can set it off before sodding off on a long weekend and returning to find the job done. However, I have not managed it yet.

    I cannot get the syntax right when trying to copy to the shared MyBookWorld drive. I have no idea about how to locate directories. In windows I could say, for example, C:/users/robsa/my docs/media/tv/the simpsons or whatever, but I have no idea how to do it in OSX. Also, ditto accessing the MyBookWorld directories which I see in 'SHARED' in finder. Again, in windows it would be something like //MyBookWorld/Media/TV/... and so on. I have tried all sorts of different things but nothing works.

    so I want to say something like:

    cp -r C:/users/robsa/my docs/media/tv/*.* //MyBookWorld/Media/tv

    if you see what I mean. Except it would be, on a mac:

    cp -r Users/Robsa/Downloads/ SHARED/MyBookWorld/Media/

    But this does not work, nor do any variations I have tried.

    PLEASE can someone help a dumb newb out?! :eek:)

    I just want a robust way of copying all these files over which isnt going to fall over....

    Many thanks in advance!


    Robsa
     
  2. plinden macrumors 68040

    plinden

    Joined:
    Apr 8, 2004
    #2
    To copy your home's Downloads directory, just use ~:
    Code:
    cp -r ~/Downloads ...destination...
    
    As for the destination, mounted drives are under /Volumes. What does this show?:
    Code:
    ls /Volumes
    
    If your external drive is called MyBookWorld, you'd type:
    Code:
    cp -r ~/Downloads /Volumes/MyBookWorld/.
    
    This will copy the Downloads directory to the root of MyBookWorld, so you'd see a Downloads directory there.

    If you just want to copy the contents of Downloads (including sub directories) use:
    Code:
    cp -r ~/Downloads/* /Volumes/MyBookWorld/some\ destination\ directory/.
    
     
  3. splitpea macrumors 6502a

    Joined:
    Oct 21, 2009
    Location:
    Among the starlings
    #3
    Use a leading forward slash to reference the root directory of your system:

    [NOTE: brackets indicate a placeholder. Remove the brackets and replace the contents with the actual directory, volume, user, etc name]

    System root:
    Code:
    /
    External drive root:
    Code:
    /Volumes/[volumename]
    Users directory:
    Code:
    /Users
    Applications directory:
    Code:
    /Applications
    Your home directory (two ways to reach):
    Code:
    /Users/[yourusername]
    ~/
    Your Desktop:
    Code:
    ~/Desktop
    Whatever directory you're currently in:
    Code:
    .
    Find out what directory you're currently in:
    Code:
    pwd
    List what's in the current directory (short listing, long listing, long listing showing hidden files):
    Code:
    ls
    ls -l
    ls -al
    List what's in a nother directory:
    Code:
    ls [directoryname]
    ls -l [directoryname]
    ls -al [directoryname]
     
  4. misterredman macrumors 6502a

    misterredman

    Joined:
    Oct 3, 2007
    #4
    I'd like to add that when you don't know the path to a folder or file all you need to do is drag the file or folder in a terminal window. The path will show up automatically.

    So in your case you could write
    Code:
    cp -R 
    and then paste the source folder in the terminal window. Then paste the destination folder and you have your command.

    If your copy process is interrupted in the middle, you can use the rsync command to complete it, without having to start from scratch.
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    Location:
    Brobdingnag
    #5
    If the file copying doesn't work using the Finder, then the command-line is not likely to work any better. The command-line isn't magic, and there's no improved reliability of data transfers because you're using the 'cp' command.

    If Finder file-copying consistently fails (or even inconsistently fails), maybe the MyBookWorld unit is defective, or your network is unreliable.

    However, there is one command I'd like you enter, and then paste its output into a post here:
    Code:
    mount
    
    Yup, that's it. Just mount.

    The output should be a list of disks, networked shares, etc. In other words, anything and everything that's currently mounted (including a few things you might not realize are mounted).

    Finally, are you using wired or wireless networking when attempting this massive data transfer? If it's wireless, you might consider switching to wired for the duration of the file transfer.
     
  6. Robsa thread starter macrumors newbie

    Joined:
    Feb 1, 2009
    #6
    Fantastic, thanks very much guys, all replies very useful and much appreciated. :)

    the MyBookWorld volume isnt listed so I assume I need to mount it? its plugged in to my wireless router.

    result of MOUNT command:

    /dev/disk0s2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    /dev/disk2s0 on /Volumes/XP_PRO_SP3 (cd9660, local, nodev, nosuid, read-only, noowners)
    afp_00yVhe00yVhe00yVhe00yVhe-2.31000006 on /Volumes/Download (afpfs, nodev, nosuid, mounted by robsa)

    I'm thinking it may be something to do with the MyBookWorld using a proprietry OS? I will try plugging the HDD directly in to my laptop - I think I will need a crossover cable for this as the HDD is designed to only be plugged into a router.
     

Share This Page