Scripting a ftp server

How would one do a series of “do shell scripts” to get a ftp server? I have no idea how one would handle the username and password prompts.

Using “curl”, you can include your login info in the url itself in each operation. Eg, to make a dir:

do shell script "curl -Q 'MKD /html/newdir' ftp://user:pass@ftp.server.com"

thanks. how would i use that same method, but to send a file to the server?

This is the line that would go into a shell script:


Echo "Uploading page"
ftp -u ftp://username:password@ftp.servername.org:21/foldername/ index.htm

And you could put it to use in an applescript like this:

do shell script "ftp -u ftp://username:password@ftp.servername.org:21/foldername/ " & theFile

Hope this gets you started, i used this to blog to an unscriptable site.

Hi Tieke,
I’m finding this REALLY interesting. I tried your do shell script and this was the AppleScriptResult:

tell current application
do shell script “ftp -u ftp://public:OpenAccess@203.134.191.120/21 /Users/username/Desktop/DeleteMe.txt”
“The command exited with a non-zero status.”

Does this mean anything to you? And what is the “/21” in the shell command? A port number?

I’d LOVE to be able to make this work.

Regards,
Bobster.

The “21” is a port number.

I see you’re using “/21” instead of “:21” as indicated in the shell script above…

Aha! That could be the problem. Thanks for being more observant than I.
Bobster.