AppleScript and rsync help

Discussion in 'Mac Programming' started by epeabody, Mar 11, 2006.

  1. macrumors newbie

    Joined:
    Dec 6, 2005
    Location:
    San Francisco
    #1
    Howdy All,

    I need some help with an AppleScript application that I am working on (see below). It basically mounts a network drive and then backs up my photos to the network drive. A little background: I have a network attached storage device that only operates with SMB/CIFS at 192.168.0.198 with a share called BACKUP and my pictures are all in the default OSX Pictures folder.

    The first part of my script works, that is that it will mount the network drive if it is not already mounted. Unfortunately the backup part doesn't work. I recently switched from PC to Mac so I am still learning how unix specifies drive locations and how the unix applications work. I think that rsync should be the correct thing to use but I am apparent doing something wrong because nothing happens . Also for some reason, when I compile the script a bunch of spaces get added to the directory string.

    Thanks for the help.
    Eric


    Code:
    tell application "Finder"
    	if not (exists disk "BACKUP") then
    		mount volume "cifs://WORKGROUP;SARIC@192.168.0.198/BACKUP"
    		delay 3
    	end if
    	
    	if exists disk "BACKUP" then
    		try
    			do shell script "rsync -vaE --delete " / Users / Saric / pictures / " " / Volumes / Backup / pictures / ""
    		end try
    	else
    		try
    			display dialog "Error mounting BACKUP."
    		end try
    	end if
    	
    end tell
     
  2. macrumors member

    rehlers

    Joined:
    Feb 13, 2006
    Location:
    Phoenix, AZ - USA
    #2
    I'm not familar with apple script, but i use rsync to backup my files over the network. Does the rsync command work when you run it from the command line? Are you surrounding the paths with "'s, or is that something that applescript is adding in? You should not need the quotes since there are no spaces in the path name.
     
  3. macrumors 6502

    Joined:
    May 12, 2003
    #3
    Code:
    do shell script "rsync -vaE --delete " / Users / Saric / pictures / " " / Volumes / Backup / pictures / ""
    
    I don't get what that line is all about. Are you sure you don't mean something like:

    Code:
    do shell script "rsync -vaE --delete /Users/Saric/pictures/ /Volumes/Backup/pictures/"
    
    I'm not familiar with rsync and the arguments you're using, but the paths definitely seem strange the way you first wrote them.
     
  4. thread starter macrumors newbie

    Joined:
    Dec 6, 2005
    Location:
    San Francisco
    #4
    I figured it out.

    I figured out the problem. The paths were getting screwed up when I compiled the script because I had double quote marks surrounding the paths instead of single quote marks which are needed because the paths were inside of a quoted line. The script works great now.

    Thanks.
    Eric
     

Share This Page