FileWatcher - Script for FTP, SFTP, FTPS and FTPES

Discuss our other products here. Get help with installation and running, notify us of bugs, request new features and enhancements.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia

FileWatcher - Script for FTP, SFTP, FTPS and FTPES

Post by DataMystic Support »

This document provides all the information you need to send files via FTP, SFTP, FTPS and FTPES when the file is dropped in a folder.

File Watcher detects the completed file being dropped, and then triggers FileZilla, an open source FTP agent.

Please use standard FTP supplied with Windows using a batch file (ftp.bat, called by FileWatcher) and a script (ftp_script.txt)
FileZilla does not support sending files via the command line – it can only open the GUI at a given domain.
WinSCP can also be used for SFTP, FTPS and FTPES, but it will require slightly different scripting.

Step 1. Save the following file as ftp.bat, and record the path.


Code: Select all

@echo off
Echo Running FTP
ftp -i -n -s:ftp_script.txt hostname
echo Now delete or move local files so they can't be transferred again

Step 2. In the same location as ftp.bat, create a script command file for FTP - this logs in and transfers your file:


Code: Select all

lcd <your local folder>
cd <your remote folder>
mput *.*

Step 3. In FileWatcher, set the Action to ftp.bat, using the complete path from Step 1. The parameters are irrelevant, as standard FTP can't be told exactly which files to transfer (you could try a commercial client). Since all files must be transferred, you must delete them or move them out of the way after FTP to prevent them being processed on the next run.

For FTP command line reference:

Code: Select all

  -i              Turns off interactive prompting during multiple file
  -s:filename     Specifies a text file containing FTP commands; the
                  commands will automatically run after FTP starts.
  host            Specifies the host name or IP address of the remote
                  host to connect to.
Post Reply