CP help - terminal woes

Discussion in 'Mac OS X Server, Xserve, and Networking' started by Karatehero, Nov 9, 2009.

  1. Karatehero macrumors member

    Joined:
    Jan 5, 2004
    Location:
    Pittsburgh
    #1
    I hate the terminal. I know its the lifeblood to most mac/linux users, but I can't ever get it to work for me. I'm trying to do something so simple too.....

    I have a server that died. Apple replaced it under warranty (I was most happy). I have my public folder and my users folder on my old server that I need to copy the files to my new server. I want to copy the public folder withOUT permissions and I will manually rebuild all ACLs (they got all fubared). I want to copy the users folder into the new macs' user folder and retain my acls.

    I was told to do this with the terminal and CP. I was going to user Superduper and its nice 'preserve ACLs checkbox' but I'm not sure if it will work for me. Instead, I'm going to boot my new server into target disk mode (I've never done this - I assume is shows up under my mnt directory?) and connect it to the old server. I worked out 2 commands to run.

    For copying public without ACLs:
    cp -vR /oldserver/public /newserver/public
    For copying users with ACLs:
    cp -pvR /oldserver/users /newserver/users

    (I realize I don't need the -v but its nice to see it working)

    Right? Thing is, it copys the files in their containing folder into the new folder. So - I would end up with /newserver/public/public/.......

    How do I tell it to copy my files into the directory and not into a directory in that directory?

    On top of that, is there an easier way to do this? I looked at Rsync, but I woudl end up with 1000 switches, and I don't have files to merge - my destination is empty.

    Thanks in advance!
     
  2. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #2
    Here you go:

    For copying public without ACLs:
    cp -vR /oldserver/public/* /newserver/public

    For copying users with ACLs:
    cp -pvR /oldserver/users/* /newserver/users


    Rsync wouldn't require a lot of switches either, but cp will work just fine:

    rsync -av /oldserver/public/ /newserver/public

    Once you boot the system into target disk mode, it will show up under /Volumes.
     
  3. Karatehero thread starter macrumors member

    Joined:
    Jan 5, 2004
    Location:
    Pittsburgh
    #3
    Thank you 1000 times! I'm going to try and play with this and we'll see what happens. That makes some good sense though.

    Can I ask you another question? When going through syncing and the such I keep coming across the term 'recursion'. I know that it means a function defining itself with its own definition, but how does that apply to syncing?

    Thanks again!
     
  4. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #4
    Post that error message. I haven't seen a recursion error message with rsync.
     
  5. Karatehero thread starter macrumors member

    Joined:
    Jan 5, 2004
    Location:
    Pittsburgh
    #5
    See, here is what gets me. I have 2 drives - Server HD and ExtServer. I want to copy the contents of the public folder on ExtServer into the Public folder on Server HD. I typed this:

    fileserver-1:Server HD admin$ cp -vR /Volumes/ExtServer/Shared\ Items/Public/* /Volumes/Server\ HD/Shared\ Items/Public/

    I get a bazillion errors back:

    cp: /Volumes/ExtServer/Shared Items/Public/weekly kiln data: unable to copy extended attributes to /Volumes/Server HD/Shared Items/Public/weekly kiln data: Permission denied
    /Volumes/ExtServer/Shared Items/Public/weekly kiln data -> /Volumes/Server HD/Shared Items/Public/weekly kiln data
    cp: /Volumes/Server HD/Shared Items/Public/weekly kiln data/1010805.xls: No such file or directory

    So, I guess:

    1 - Do I need to run this as root or something?
    2 - Obviously my files and directorys aren't there - I want to copy them in!

    Can someone help me!!!!?????

    EDIT - I needed to run it as root. That fixed it.
     
  6. belvdr macrumors 603

    Joined:
    Aug 15, 2005
    #6
    Yep, and in the future if you want to resync those directories, use rsync. It will run much much faster.
     

Share This Page