Copying files from one server to another

I have a script that was working and copies files from a folder on one server to a folder with the same name on another. Now I have introduced another level of complexity that has created a problem.

One of the folders I am trying to copy to is an alias of a folder somewhere else on the server. I build my “TO” folder thus:


set to_folder to folder ("blah:blah:blah:" & foldername) as alias

This works for all ‘foldername’ that are real folders on “blah:blah:blah”. However, when ‘foldername’ is an alias on “blah:blah:blah”, the following:


move my_file to to_folder with replacing

gets and error message that says it can’t make <> into an alias. Apparently there is something about it being an alias in the first place that is causing the problem. Can someone help me get this working? TIA.

Change this:

set to_folder to folder ("blah:blah:blah:" & foldername) as alias

to:

set to_folder to ("blah:blah:blah:" & foldername) as alias
if alias of (get info for to_folder) = true then tell application "Finder" to set to_folder to (original item of to_folder) as alias

Jon

Thanks, that seems to have fixed it. :smiley:

I can’t say I understand what you are doing as much of Applescript seems like black magic to me. If you have a few minutes, an explaination would be much appreciated.