Is it possible to specify overwrite older file in sync script

I typically sync my laptop and desktop machines when I have to work elsewhere than the office. For this task I usually use rsync from a shell script. For the case where a file of the same name exists on the target directory, Rsync can be told to copy only in the case that the file to be copied is newer. I found, however, that this can cause problems with keynote files (as they present themselves to the file system as a directory). In effect, rsync will break/screw up keynote presentations by copying inappropriate bits into the keynote destination directory. The problem stems from the fact that the two-at-a-time based file copying criterion is inappropriate for package based documents such as keynote. I have disabled this in the rsync script, and I was hoping to achieve a backup for the keynote files through an automator/applescript solution. I can't find to specify an overwrite only in the case where the file being copied over is older. Is there a way to do this in automator? I imagine it is possible in AppleScript, but I have much to learn there. Any suggestions?

2.53 GHz MacBook Pro and Eight-core MacPro, Mac OS X (10.5.6)

Posted on Apr 28, 2009 7:51 PM

Reply
3 replies

Apr 28, 2009 8:51 PM in response to Paul Fons

AppleScripts and Automator's Run AppleScript action can run your rsync shell script (there is also Automator's Run Shell Script action). Are you saying you have modified rsync, or are you talking about the options you are using? The Sync Folders action available in Apple's Automator Downloads looks like it might also be handy to use for a custom rsync command, since the one it uses is in a .command file.

Apr 28, 2009 9:07 PM in response to red_menace

I don't know about the sync script -- it is not in the default installation -- I assume it is on the automator.us site. I will check. In regards to your question about rsync -- I have specified options (there are many) and have specified by a list of patterns which files not to sync. Rsync is a wonderful utility, very fast, can go through ssh, and has oodles of features. Unfortunately, its decisions on whether to copy are all based upon file by file comparisons -- hence the keynote problem. I will look at the automator site to see if there is a sync script, but I am afraid it will suffer from the same problem (copy individual files within a package) and end up breaking my keynote presentations.

Apr 28, 2009 9:19 PM in response to Paul Fons

The sync actions I have seen for Automator tend to be of a more general purpose nature. If you already have a custom rsync command that works for you, it can be used as I mentioned above. I also mentioned the Sync Folders action because it uses a simple .command file with a rsync -aE --delete-after in it (this is more or less what most of the sync actions use). You may be able to just drop your rsync options in it's .command file for a quick custom action (not sure if the author intended it this way, but it seems kind of handy).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is it possible to specify overwrite older file in sync script

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