Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

radix

Keep Connection Alive

I have a scanner that drops files into a folder throughout the day. I need to automatically upload these files to a server. I created this script to do that job, and a .bat file for my users to launch WinSCP.

But, how can I keep the connection alive, or reconnect every time a file is placed in the required folder?

Script:
# Automatically answer all prompts negatively not to stall

# the script on errors (off), set to 'contunue' to ignore all errors.
option batch off

# Attempt reconnect in 3 seconds if connection fails
option reconnecttime 3

# Disable overwrite confirmations that conflict with the previous
option confirm off

# Open connection to server
open ftp://[server].com:[port#]

# Synchronize directories so 'keepuptodate' won't cause problems.
synchronize both "C:\Documents and Settings\user\Desktop\FTP_folder"

# With the sync we can use 'uptodate' to keep the folders synced
keepuptodate -delete "C:\Documents and Settings\user\Desktop\FTP_folder"