JSI Tip 0925. How do I script an FTP session?

You can create an FTP script using any valid commands that you would type at the FTP prompt.

If your manual FTP session was:

open 23.21.123.13
UserName
Password
put myfile
quit

you can script this by creating myscript.scr file that contains:

user UserName Password
put myfile
quit

and then typing:

FTP -s:myscript.scr 23.21.123.13

The only exception to this is if the FTP host has auto-login implemented. In this case, add a -n parameter:

FTP -n -s:myscript.scr 23.21.123.13

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish