Sunday, January 16, 2011

MobileMe Sync Options


A long time ago, I wanted to be able to sync any folder with my MobileMe disk. Unfortunately, the only way at the time was to drag that folder over to MobileMe - and I'd have to do that every time I modified that folder. Conveniently for me, I was working with AppleScript at the time. (Perhaps the work with AppleScript even prompted my thought flow to delve into the MobileMe sync script that I was about to write.)

I planned to write an AppleScript that would sync the folders I wanted with the MobileMe (iDisk) folders - and create new MobileMe folders, if they did not exist.

Below is the simple code, which utilizes rsync.

do shell script "rsync -a -E -4 -v ~/Documents/thisFolder/ ~/Documents/thatFolder/"
NOTE: It is very important that you put a slash at the end of the source and destination, because if you do not rsync will copy a folder into the destination folder. However, the goal is to just copy the files of a folder into the destination folder.
It might seem to some that you could just do without the slash in the source and then tell it to go to a destination one level above where the desired destination would be. By syncing - which in this case could be visualized as copying - a folder into a hierarchially higher destination, the folder would end up one level lower, right where it should be.
Nevertheless, I believe that the aforementioned code is the best, because it allows the user to not have to worry about folder names, etc, and it is generally less confusing.

Later, I will post more dynamic code. Essentially, one AppleScript adjusts a text file with all folder sources and corresponding folder destinations; the other reads from that text file and syncs appropriately.

No comments:

Post a Comment

Search This Blog