OS X, FTP Command Line Options

3 replies [Last post]
BDub's picture
Offline
Joined: Dec 20 2003
Posts: 706

Hey -

I'm trying to create an Applescript for OS X that'll allow a user to drop a file onto it, then the script will log onto my FTP server, give username and password, and upload the file, then log out. Basically, it's to save some clients from having to use an FTP client.

I know I can give commands in this format

ftp :command:command:quit

What I want to know is how to include the password with that? I can make the line work properly, except that it prompts me for a password each time. I'd rather not do that, if at all possible.

__________________

"There is going to be a future: let's chase it until it kills us." - Spider Robinson

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jon's picture
Jon
Offline
Joined: Dec 20 2003
Posts: 2804
IIRC the URL standard for inc

IIRC the URL standard for including a pw is something like:

ftp user:passwd@site.com

Yep, it's right there on the man page for ftp. I dunno if it works like that through AppleScript, but it would work quite well in a bash/tcsh/etc script.

__________________

I am not in this world to live up to other people's expectations, nor do I feel that the world must live up to mine. - Fritz Perls

BDub's picture
Offline
Joined: Dec 20 2003
Posts: 706
Hmmm...tried that and it refu

Hmmm...tried that and it refused, even from terminal. Perhaps it's something odd with my FTP server itself. Let me try it out on another few I have passwords for, and see if it works.

__________________

"There is going to be a future: let's chase it until it kills us." - Spider Robinson

Jon's picture
Jon
Offline
Joined: Dec 20 2003
Posts: 2804
You might try enclosing some

You might try enclosing some of the funky parts with quotes to protect it from the shell trying decode it into commands:

ftp "user:passwd@site.com"

I know I have to use that trick when I want curl to work right on a multiple file grab:

curl "http://www.site.com/files/image[001-150].jpg" -O

and some other fun things.

__________________

I am not in this world to live up to other people's expectations, nor do I feel that the world must live up to mine. - Fritz Perls