Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

epeabody

macrumors newbie
Original poster
Dec 6, 2005
4
0
San Francisco
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
 

rehlers

macrumors member
Feb 13, 2006
76
21
Phoenix, AZ - USA
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.
 

therevolution

macrumors 6502
May 12, 2003
468
0
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.
 

epeabody

macrumors newbie
Original poster
Dec 6, 2005
4
0
San Francisco
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.