Applescript to replace my synchronizing .BAT

Discussion in 'Mac Programming' started by Howard Brazee, Jun 13, 2007.

  1. Howard Brazee macrumors 6502

    Howard Brazee

    Joined:
    Oct 24, 2006
    Location:
    Lafayette CO
    #1
    I only have one Macintosh at home, but am saving up for a second. But I still have two Windows machines, where I synchronize files with batch files containing commands such as:

    xcopy "%USERPROFILE%\My Documents\My Pictures\*.*" "\\HOWARD\C:\Documents and Settings\brazee\My Document\My Pictures\*.*" /Y/S/D

    xcopy "\\HOWARD\C:\Documents and Settings\brazee\My Document\My Pictures\*.*" "%USERPROFILE%\My Documents\My Pictures\*.*" /Y/S/D

    I would like to synchronize the photos on the Macintosh the same way. I have some problems getting started:

    1. It seems that I need to mount my Windows machines by hand. I suspect this can be automated, but I don't yet know how.
    2. I don't yet know Applescript (I will learn faster when I get my own Mac, but my wife is always on hers).
    3. All of our camera photos are loaded on her Mac using iPhoto, without the sub-directory structure that is so useful on Windows machines. (and would be even more useful on iPODs, if it was available).
    4. Currently, I can use symbol to run the same batch job on each of my Windows machines - I'd like to be able to run this synchronization from either my Windows machine (when my wife is using hers), or from her machine (when she's doing something else). And eventually synchronize our Macintoshes.
     
  2. longofest Editor emeritus

    longofest

    Joined:
    Jul 10, 2003
    Location:
    Falls Church, VA
    #2
    I don't know a ton about Applescript, but for starters, have you seen if Automater can help out at all?
     
  3. Howard Brazee thread starter macrumors 6502

    Howard Brazee

    Joined:
    Oct 24, 2006
    Location:
    Lafayette CO
    #3
    I looked at that page briefly a while ago - One thing that I have in my batch file is that it only copies files that are newer than those on the other computer. I suspect that I will need to figure out how to do that on a Macintosh before I could automate that procedure.
     
  4. jeremy.king macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
  5. Howard Brazee thread starter macrumors 6502

    Howard Brazee

    Joined:
    Oct 24, 2006
    Location:
    Lafayette CO
    #5
    That looks promising. I bookmarked it to have it available when I get closer to having a clue. (I'm still at the stage where I am trying to understand Macs at all, much less words such as "chron" and "cocoa", nor seeing how to automate mounting a LAN drive, and telling iPhoto to store photos in a way that translates to a file structure when exported).
     
  6. blackstone macrumors regular

    Joined:
    Dec 12, 2005
    Location:
    Washington, DC
    #6
    rsync has very advanced synching capabilities. If you just want to copy by date, though, you should also look in to using the ditto command, which preserves resource forks.

    In either case, the best starting place would be a tutorial on UNIX shell scripting, which will help get you up to speed on how to create command line scripts similar to the .BAT files you're familiar with in the DOS/Windows command line.
     
  7. SC68Cal macrumors 68000

    Joined:
    Feb 23, 2006
    #7
    rsync has been updated to support resource forks
     

Share This Page