The Professional Way to Move Files!
TOC PREV NEXT INDEX

Chapter 11: Scripting

The WS_FTP Scripting Utility allows you to group any number of file transfer tasks into a script that can be executed with one action. This can be especially useful for file transfers that you do repeatedly.

This chapter gives an overview of the Scripting Utility and some examples of how you might use it. For detailed instructions on using the Scripting Utility, start the Scripting Utility and use its online Help.

Using scripts, you can:

Scripts can also have some limited flow control. They can:

Suppose you post weekly reports on your company's FTP server for your co-workers in other cities to download. Let's assume you place the current week's reports in a folder named Current. You could create a script that:

You can also create scripts for downloads that you do repeatedly.

Using Scripting


Start the Scripting Utility by doing one of the following:

Writing and Debugging Scripts


To write and/or debug a script, start the Scripting Utility.

The Script Editor/Debugger window appears

.

An MS-DOS window is automatically opened behind the Editor/Debugger window to show you the output of SHELL commands.

Executing Scripts


You can execute scripts from either the Command Prompt or
from the Scripting Utility itself.

Executing a Script from the Command Prompt

Go to the Command Prompt and type ftpscrpt followed by the appropriate command line parameters. For example:

ftpscrpt -f script1.scp
 

There are other parameters you can use with the ftpscrpt command. For detailed information, go to the Scripting Utility online Help and see "Executing Scripts."

To be able to run a script from any location on your hard disk, we recommend that you place the Scripting Utility folder in the Path statement in your Autoexec.bat file - if you are running Windows 98, Windows ME, and Windows XP. If you're using Windows NT or Windows 2000, add the WS_FTP Pro folder to the path variable in the System Environment.

Running a Script from the Scripting Utility


To run a script from the Scripting Utility, start the utility, open
the script, and click Go.

Example


In the following example, the script:

  1. Turns on the Trace command to send detailed information to
    the transfertrace.txt file.
  2. Creates a log called transferlog.txt in the C:\ directory.
  3. Logs onto the server with the user name sdavis.
  4. Logs onto the server with the password fourthandgoal.
  5. Connects to the FTP server ftp.mywebprovider.com.
  6. Changes the remote directory to /user/sdavis/images.
  7. Changes the local directory to C:\My Documents\My Pictures
  8. If the MGET is successful, the script executes the FILEDELETE label.
  9. If the MGET fails, the script executes the DISCONNECT label.
  10. All files ending in .jpg are copied from the remote directory to the local directory.
  11. This line identifies the FILEDELETE label.
  12. All files ending in .jpg are deleted from the /user/sdavis/images remote folder.
  13. This line identifies the DISCONNECT label.
  14. Disconnects from the FTP server.



Ipswitch, Inc.
http://www.ipswitch.com
TOC PREV NEXT INDEX
©Ipswitch 2003