I am a new at AppleScripting and would appreciate any help I can get with the following script.
Context: I have 7 photographers shooting digital in my studio. Each day they create a folder on the desktop with the days raw captures and processed final shots. I need these folders to get backed up automatically on a nightly basis. I have the script below making a folder on the backup volume named with the users name and current date. This part of it works.
Problem: I get an error each time the script runs. It does not complete the copying of the contents of the desktop folder. Everything else seems to work fine. Anyone have any ideas?
Here is the script as it is now:
set namevar to “Photo2”
– sets the namevar to the computer users name
try
mount volume “afp://username:password@192.168.22.8/HiRes/”
– mounts HiRes volume
on error errText number errNum
display dialog “An Error Occured mounting server” & “Error Number” & errNum & “”
end try
– if there was a problem, it tells you
tell application “Finder”
make new folder at folder “HiRes:CaptureBackup:” with properties {name:“TEMP”}
–the finder makes a new temp folder
set file_location to "HiRes:CaptureBackup:"
-- sets the file path
set folder_name to namevar & (do shell script "date +%m_%d_%y")
-- sets the variable folder_name to namevar and the date
set file_path to ((file_location as string) & folder_name & ":")
-- sets the file path to the file location and the folder name that was set above
set file_alias to ("HiRes:CaptureBackup:TEMP") as alias
-- sets the path to the server volume
tell application "Finder"
set name of file_alias to folder_name
-- sets the folder alias (temp folder path) variable to the folder name
end tell
move folders of folder "Desktop" of folder namevar of folder "Users" of startup disk to file_alias
-- moves only folders in the desktop folder to the server
end tell
Also, does anyone know how to get the current users name automatically so I do not have to hard code it? And is there an easy way to make a log file of what has been backed up successfully?
Thanks,