I have an AppleScript that mounts a network smb share, creates destination folders (if they don't exist) then copy files to the destination folders with replacing. It then unmounts the smb share.
I have heavily edited to remove sensitive information but the gist is:
-- AppleScript to backup crucial files from server without TimeMachine
-- J Harris 20-12-13
-- v1 created alias and used this for folder creation 26-12-13
-- v2 added share4 folder 03-01-14
-- Mount the destination and create an alias
mount volume "smb://<username>:<password>@server.domain.com/sharename"
set server to result as alias
-- do the copy
tell application "Finder"
-- Create destination folder & copy the * files. This will overwrite all files
if not (exists POSIX file "/Volumes/sharename/share1") then make new folder with properties {name:"share1"} at server
duplicate items of folder "Macintosh HD:<location to share1>" to POSIX file "/Volumes/sharename/share1" with replacing
--Create destination folder and copy the ** files. This will overwrite all files
if not (exists POSIX file "/Volumes/sharename/share2") then make new folder with properties {name:"share2"} at server
duplicate items of folder "Macintosh HD:<location to share2>" to POSIX file "/Volumes/sharename/share2" with replacing
--Create destination folder and copy *** files. This will overwrite all files
if not (exists POSIX file "/Volumes/sharename/share3") then make new folder with properties {name:"share3"} at server
duplicate items of folder "Macintosh HD:<location to share3>" to POSIX file "/Volumes/sharename/share3" with replacing
--Create destination folder and copy all local **** files. This will overwrite all files
if not (exists POSIX file "/Volumes/sharename/share4") then make new folder with properties {name:"share4"} at server
duplicate items of folder "Macintosh HD:<location to share4>" to POSIX file "/Volumes/sharename/share4" with replacing
-- Unmount the destination
eject server
end tell
I saved it as an app and it works beautifully.
I then tried to schedule the task using Lingon to edit launchd. I have read that you can't point launchd to the application itself, you have to point it to the app/Contents/MacOS/Applet
When it runs, I get an AppleScript Editor error "Folder some object not found".
Anybody got any ideas?
Thanks in advance
John