Creating a Windows FTP script

Question

Creating a Windows FTP script.

Answer

Creating a FTP script can help make uploading and managing files between your computer and your server a lot easier. Below are the steps required for creating a FTP script in Microsoft Windows.

Create a text document with commands used when in FTP.  Below is an example of what such a script may look like:

open ftp.domain.com
username
password
cd public_html
dir
get file.txt
bye

The above script will log into the ftp site ftp.domain.com. Once connected, it will enter the username and then the password (substitute username for your username and password for your password). Once logged in, the script then goes into the public_html directory, gets a directory listing and then uses the get command to get the file called file.txt. Once the file is received, it logs off using the bye command.

Once the script file has been created, for example, if it was called script.txt, to execute this script with ftp you would type:

ftp -s:script.txt

If Windows FTP does not offer enough scripting options for you you may also want to consider WinSCP, which has a command mode that can be used for scripting and also allows the ability to connect to a secure FTP server.

Additional information

  • Category
  • FTP help
  • Solved?
  • Were you able to locate the answer to your question?