View Full Version : Help with Copy command + office

19th November 2008, 11:03 AM
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@" /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/


19th November 2008, 11:34 AM
Where is the command that shows the initial copy-to-fileserver?

20th November 2008, 07:51 AM
Ah there is none - The folder is already sitting on the file server??

20th November 2008, 08:49 AM
So how can you be sure you made the copy-to-server 100% and it is entirely intact/together?

20th November 2008, 09:18 AM
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:


open afp://username:password@

sleep 5

cp -Rp /Volumes/Juno/Applications/Microsoft\ Office\ 2004 ~/Desktop

sleep 2

diskutil unmount /Volumes/Juno


24th November 2008, 08:39 AM
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

24th November 2008, 09:39 AM
Enter your own account details?