Thanks for the reply. Although the suggested module didn't work for me I managed to find something in the end that should satisfy the requirement:

Requirement: Periodically scan a directory on a Windows Server and compile a list of xml files if there are any present. SFTP that list of files to a destination SFTP server. Once the transfer is successful remove them from the local server.

This thread got me thinking about using a simple WinSCP script to do the file transfer.

Using WinSCP Version 4.1.8 (which supports Hostkey validation during the authentication process with the -hostkey option) I built the following script:

option batch on option confirm off open sftp://user:password@servername:22 -hostkey="hostkey" lcd d:\localdir cd /remotedir option transfer binary put *.xml close exit

In the end a Windows Service will periodically scan a directory. During each iteration, should we find any xml files, we will call the above script to connect and transfer the files. If the transfer is successful the xml files will be removed locally afterwards.

There are still some loopholes that would need to be resolved, like securing the script (encryption maybe?), more efficient error checking during the actual transfer, to name but a few. I'm still considering some ideas.

Scrat


In reply to Re^2: Net-SSH-W32Perl hanging by Scrat
in thread Net-SSH-W32Perl hanging by Scrat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.