SFTP - Solution


Recommended Posts

Hi,

I know there's a post about this somewhere else - but as I have a solution (that doesn't cost a cent) - I thought I'd share it with all you nice folks.

I'm using a sequence in DAQFactory to save my daily log files in a particular local folder and start a new log file each night at midnight.

Though I've tried all sorts of things from DAQFactory sequences to Java programs to send the name of the previous day's log file name to a batch file etc etc for uploading to a remote site using sftp, nothing really seemed satisfactory, Until...

I found hidden away in the documentation for the freeware sftp program I'm using, WinSCP, a command to synchronize a local folders contents and that of the remote one - in real time.

All that is needed is a batch file to call the WinSCP script, both contained in the local log file directory and to envoke the batch and the script will run in the background reflecting any log file changes - including the current one whenever DAQFactory has written to it.

Here's the batch file code (name it whatever youi like):


winscp.com /script=WinSCP_Synchronize_Script.txt
[/CODE]

And here's the WinSCP script code (name it "WinSCP_Synchronize_Script.txt"):

[CODE]
# WinSCP sychronize local and remote folders
# keep remote folder uptodate
# H Schiretz April 2012
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp://yourusername:?yourpassword@yourserver.com -hostkey="<fingerprint>"
# keepuptodate The local directory and the remote directory
keepuptodate c:\Users\hschiret\Documents\UNE_MonoEvap_Project\Log_Files public_html/Field_Logs
[/CODE]

Link to comment
Share on other sites

Thanks Andrew but I think you can only do what I'm doing with the pro version and it's not free !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share