Welcome to MacTalk Australia

the largest Australian community for Apple discussions and topics

» Join the discussions, Register Now!
Results 1 to 7 of 7
  1. #1

    Default Help with Copy command + office

    Hey guys,

    I'm trying to write a little script to copy Office 2004 folder from my fileserver to replace an older version on a mac but running into some trouble.

    I'm fairly new to the terminal game so any help appreciated.

    This is the 'script' i've written to do it but after it's finished the executables aren't launchable??

    Ideas?? If I do the copy manually there aren't any problems


    mkdir /Volumes/Updates
    mount_afp "afp://;AUTH=No%20User%20Authent@152.146.138.18/Updates" /Volumes/Updates
    sleep 2
    rm -r /Applications/Microsoft\ Office\ 2004
    cp -R /Volumes/Updates/Microsoft\ Office\ 2004 /Applications/
    chmod -R 775 /Applications/Microsoft\ Office\ 2004
    sleep 2
    umount /Volumes/Updates/

    Cheers,
    Dave

  2. #2

    Join Date
    Jul 2005
    Location
    Sydney
    Posts
    12,045

    Default

    Where is the command that shows the initial copy-to-fileserver?

  3. #3

    Default

    Ah there is none - The folder is already sitting on the file server??

  4. #4

    Join Date
    Jul 2005
    Location
    Sydney
    Posts
    12,045

    Default

    So how can you be sure you made the copy-to-server 100% and it is entirely intact/together?

  5. #5

    Join Date
    Mar 2004
    Location
    Berkeley, CA
    Posts
    1,215

    Default

    I suggest using the -p flag with cp (in your case, cp -Rp) and not using the chmod command at all.

    From cp's man page:

    -p Cause cp to preserve the following attributes of each source file in the copy: modifica-
    tion time, access time, file flags, file mode, user ID, and group ID, as allowed by per-
    missions. Access Control Lists (ACLs) will also be preserved.

    If the user ID and group ID cannot be preserved, no error message is displayed and the
    exit value is not altered.

    If the source file has its set-user-ID bit on and the user ID cannot be preserved, the
    set-user-ID bit is not preserved in the copy's permissions. If the source file has its
    set-group-ID bit on and the group ID cannot be preserved, the set-group-ID bit is not
    preserved in the copy's permissions. If the source file has both its set-user-ID and
    set-group-ID bits on, and either the user ID or group ID cannot be preserved, neither the
    set-user-ID nor set-group-ID bits are preserved in the copy's permissions.

    Also, I'd use "diskutil unmount" rather than "umount." It's a cleaner way of unmounting a volume.

    I don't understand why you are creating a mount point in /Volumes. That should not be necessary at all.

    This script works for me copying over the Office 2004 folder from an AFP mount to my Desktop:

    Code:
    #!/bin/bash
    
    open afp://username:password@192.168.1.3/Juno
    
    sleep 5
    
    cp -Rp /Volumes/Juno/Applications/Microsoft\ Office\ 2004 ~/Desktop
    
    sleep 2
    
    diskutil unmount /Volumes/Juno

    Dave

  6. #6

    Default

    Huy - If I copy it manually it works fine

    MacDave - I edited my little script with your details (Thanks!) - Now, the copy works if I use the current users username/pw but if I use guest/nouserpass the executables aren't usable.

    Is there a way to tell it to use the current logged in user details?

    Forgive my newbie questions, i've never really touched terminal before

  7. #7

    Join Date
    Jul 2005
    Location
    Sydney
    Posts
    12,045

    Default

    Enter your own account details?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •