Automate the Upload of a File to an FTP Server.txt - Notepad

Automate the Upload of a File to an FTP Server

This page explains how to automate the upload of a binary file on a Windows client to a UNIX FTP server.

Create a bat file on the Windows client with the below contents. Replace 'c:\ftp.txt' with your FTP command file (see below) and with the FTP server's IP address.

ftp -s:c:\ftp.txt

Create a text file that contains your FTP commands (c:\ftp.txt). You will need to specify the FTP user password in this file in plain text, so ensure that you lock down the permissions on the file accordingly. The below commands will copy the local file 'c:\mailbox.pst' on the Windows client, to '/home/desintation_dir' on the FTP server.

cd /home/destination_dir
put c:\mailbox.pst

To initiate the file upload, run the bat file. You can do this via a scheduled task if you like.

Note, in order to upload the file using the 'put' command, you will need to create an inbound firewall rule on the Windows client allowing remote ports 20 and 21 to access any local port.