I have a script that copies files from my download folder onto an external drive then deletes them from my work drive.
The guts of it look like this:
on run tell application "Finder" set fileList to the selection repeat with fn in fileList try move fn to folder "Cupertino:Users:douglastallman:Documents:Downloads:" replacing ask on error set newName to my erred(fn) set name of fn to newName move fn to folder "Cupertino:Users:douglastallman:Documents:Downloads:" replacing ask end try move fn to trash end repeat end tell end run
Sometimes, there's already a file on the destination drive with the same name, so when the script errors, I take the file name apart, add a date & time suffix and rename the file. But the move command now can't find the file.
In my script, fn is an alias and I was under the impression, falsely I guess, that because the name was a property, it could be changed and the alias still pointed to the same file. This script renames the file, then errors on anything that follows in the next line that calls fn.
What am I doing wrong?
doug
|