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

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

FileWatcher - Script for FTP, SFTP, FTPS and FTPES

Post by DataMystic Support » Mon Sep 10, 2012 12:40 pm

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.

ftp.bat

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
pause

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

ftp_script.txt:

Code: Select all

username
password
lcd <your local folder>
cd <your remote folder>
mput *.*
quit

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
                  transfers.
  -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.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Post Reply