FTP (file transfer protocol) is a file transfer utility commonly used to transfer files over the internet.


FTP is capable of using scripts (lists of commands from external files). The following example demonstrates a script that opens a connection to IP address 11.11.11.11, logs on to the host as a guest with the password "guest," uploads the File1.txt file, and then quits: 
TEST.SCR
open 11.11.11.11
guest
guest
put file1.txt
quit 


You must use the -s option for FTP to read this file under Windows. If the previous script was in a file called Test.scr, you can start the script by typing:
ftp -s:test.scr
You can specify the host name in the command line and then use the script to process the login. For example, if you use the following command line
ftp -s:test.scr 11.11.11.11
the script file should read as follows:
guest
guest
put file1.txt
quit
However, if the FTP host implements automatic login, this command will not work. To turn off automatic login, use the -n switch in the command line as follows:
ftp -n -s:test.scr 11.11.11.11


You can also put the call into a batch file too:

FTP.BAT
ftp -s:test.scr 11.11.11.11


*To get a file VIA FTP change PUT to GET

Article ID: 40, Created On: 12/17/2008, Modified: 11/1/2013

Feedback (0)