So I work for my school's computer repair desk and am trying to write a script so that we can choose a file to copy and have it continue to copy even if it gets an error (I believe it's error -36). I know that this can be done in Terminal, but I'm pretty sure the point of AppleScript (even advice for Automator is welcome) is to make life easier. I have this so far:
I am no expert at AS, and would welcome any changes that would make this easier if you think it would help. I have borrowed most of this from another form I found, but would like to make sure that it copies the file or folder, skipping over any files that give an error.
thanks!
Code:
[FONT="Verdana"]display dialog "Do you want to copy a Folder or a File?" buttons {"Cancel", "Files", "Folders"} default button "Folders"
copy the result as list to {buttonpressed}
try
if the buttonpressed is "Files" then moveFile()
if the buttonpressed is "Folders" then moveFolder()
end try
on moveFolder()
tell application "Finder"
set sourceFile to choose folder with prompt "Choose a Folder to Copy:"
set targetFolder to choose folder with prompt "Select Destination"
try
move sourceFile to targetFolder
on error errMsg number errNum
display dialog "Error: " & errNum & return & errMsg
end try
update targetFolder
end tell
end moveFolder
on moveFile()
tell application "Finder"
set sourceFile to choose file with prompt "Choose a Folder to Copy:"
set targetFolder to choose file with prompt "Select Destination"
try
move sourceFile to targetFolder
on error errMsg number errNum
display dialog "Error: " & errNum & return & errMsg
end try
update targetFolder
end tell
end moveFile[/FONT]
I am no expert at AS, and would welcome any changes that would make this easier if you think it would help. I have borrowed most of this from another form I found, but would like to make sure that it copies the file or folder, skipping over any files that give an error.
thanks!