Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

xcopy equivalent?

I posted this in the Leopard forum, but it appears that I was incorrect in doing that, so...

I am a long time PC user making a valiant effort to move to MAC. I am attempting to find a painless way to update a flash drive with some data that has to move between my office and home machines. There are a lot of files, but only a few change each day, and I have to make sure that an older file never overwrites a newer file with the same name.

On the PC I would simply fire up a command prompt and use the following xcopy command:

"xcopy path\dir1\ . path\dir2\ /s /h /r /c /d"

This would copy all of the files in dir1 to dir2, including all subdirectories (/s); including all hidden files (/h); including all read-only files (/r); continuing on, rather than erroring out, if a glitch develops (/c); and copying only files that are newer than those already in the target directory where the same file exists in both directories (/d)

I've been told that the "cp" command is what I want, but a review of the man file does not indicate anything similar to the /d parameter. Apparently some versions of the linux cp command allow a -u parameter, which seems to be similar, but OS X doesn't like that.

I need to make sure that an older file is never copied over a newer file, so the equivalent of the /d parameter is necessary.

What am I missing?

thanks...Bob

MacBook Pro 2.4 / MacPro 2.66, Mac OS X (10.4.10)

Posted on Jun 5, 2008 1:51 PM

Reply
5 replies

Jun 9, 2008 5:00 AM in response to bobritter

now if I can only get it to run as a script...

That is easy.

#!/bin/sh
rsync -auv src dest

Make sure the file has <LF> Unix style line ending (using a shell editor such as nano will do that, or TextWrangler if you want a gui editor).

Make sure the shell script is executable
chmod +x filename

Or create an Automator script and use the *Automator -> Utilities -> Run Shell Script* action and now you have a double clickable script.

xcopy equivalent?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.