logo Running SDI FTP from the Command Line

Return to Introduction  Previous page  Next page 

SDI FTP can be run from a windows command prompt. This allows you to run FTP operations from a batch (.bat) file or to schedule file transfers with the Windows Scheduler.  The FTP.EXE program provides the command line interface. FTP.EXE runs SDI FTP in background.

 

The following command line parameters are available.

 

/Session session_namespecifies the session to connect. Where session_name is the SDI FTP session name.  If session_name contains embedded spaces, it must be enclosed in double quotes. For example:

 

       /Session "SDI Web Site"

 

/Localdir folder_namespecifies the name of the default local folder. Where folder_name is the local folder. If folder_name contains embedded spaces, it must be enclosed in double quotes. For example:

 

        /Localdir "c:\FTP Files"

 

/Script script_name specifies a script to run after the session specified in "/Session" is connected. Where script_name is the name of the script. If script_name contains embedded spaces, it must be enclosed in double quotes. For example:

 

       /Script "Sample Script.txt"

 

 

The following example illustrates how this facility may be used. Assume that you want to download a file called "data.txt". Assume the SDI FTP session name for connecting to this host is FTP1.

 

You will need two files to complete the operation. A batch file (Sample.bat) and a script file (sample.txt). They both can be created with notepad.

 

rem Sample.bat

 

rem This is the batch file that starts ftp.exe, the command line interface

"C:\Program Files\SDI\\ftp.exe" /Session FTP1 /Script sample.txt

 

 

* sample.txt

 

* This is the SDI FTP script that contains the script commands to transfer the file.

* The "/Script sample.txt" parameter in the sample.bat file runs this script.

get data.txt

exit 0

 

Running Sample.bat at the command line prompt performs the file transfer without the SDI FTP window being displayed. This is a simple example. You could add logic to the batch file and start other programs to perform operations on the downloaded files(s). You could add logic to the script to upload or download other files or manipulate remote or local folders.