PDA

View Full Version : ftpfolder script problem




karms
Sep 14, 2008, 08:06 AM
I've use the below Applescript successfully on other Mac's to ftp files to my ftp server. I've ported it over to my G5, and I now receive this error..

"Can't get alias "Macintosh HD:Users:myname:Desktop:ftpfolder:foofile"."

I've confirmed the path to the file appears correct. Can anyone point me to what could be causing this - or what it means?

on adding folder items to thisFolder after receiving theseItems
repeat with aFile in theseItems -- assumed to be files, not folders
try
set tName to name of (info for (contents of aFile))
-- tName is the name of the one of the files in theseItems
-- do your FTP thing with the name like this:
set myFile to "~/Desktop/ftpfolder/" & tName
-- etc. i.e. all the rest of your script
set myName to "userid"
set myPass to "pswd"
set myCurl to "curl -u " & myName & ":" & myPass & " ftp://vidego.multicastmedia.com/ -T " & myFile
do shell script myCurl
delete (contents of aFile)
-- I prefer to move them to my own "discard" folder so I can check before they go.
on error theError
display dialog theError -- in case something goes wrong; don't delete, tell me
end try
end repeat
end adding folder items to



HiRez
Sep 16, 2008, 06:55 PM
Try something like this:

set tName to name of ((POSIX path of f) as string)
set uploadFileName to do shell script "basename " & quoted form of tName
set myFile to quoted form of ("~/Desktop/ftpfolder/" & uploadFileName)
...

I'm not sure exactly what the problem is (and I don't know if the code I wrote will work without some tweaking), but I do know I've had problems like that and sometimes Applescript likes POSIX paths instead of Macintosh aliases. Also I like to use POSIX paths wherever possible since they are now the stardard way to work with the Mac OS filesystem.