PDA

View Full Version : AppleScript and rsync help




epeabody
Mar 11, 2006, 07:53 PM
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



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
Mar 11, 2006, 08:13 PM
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
Mar 12, 2006, 02:05 AM
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:


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
Mar 12, 2006, 12:33 PM
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