Advertisement

07.15.2008 at 06:01PM PDT, ID: 23568179
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

VB Script or batch file for transferring files over SFTP

Asked by mrgordonz in VB Script, SSH / Telnet Software, Windows Batch Scripting

Tags:

Hi Experts,

I am setting up an application hosting service and my client needs to be able to transfer data files which will be imported into the application.  For security reasons the client doesn't have direct access to the application server except via HTTP(S).  Instead I have configured a Linux "bastion" server (CentOS) and the client can transfer files to the bastion server via SFTP.

What I want to do is create a batch file (.bat) or a VB Script file (.vbs) which will reside on the application server (Windows Server 2003).  This batch/vbs file will be executed by means of a Windows Scheduled Task and it will connect to the bastion server and check to see if there are any interface files to be collected - if so they will be transferred to the application server and processed by the application (ie: the data will be imported).

I need help with the batch/vbs file.  I have no idea how to establish a SFTP connection programmatically using either  VB Script or Windows commands (in a batch file).  My preference is for a VB Script file because I am comfortable programming in VB and it is relatively easy to write code which will check for particular file name formats, spool to log files, etc.  Essentially the bit I need most help with is making the SFTP connection, retrieving a directory listing, transferring files from the bastion to the app server, and optionally deleting the files from the bastion once the transfer is complete.

Outline of the batch/vbs file for what I want to achieve:

*  connect to bastion server with client credentials
*  retrieve directory listing into array
*  check filenames to see if they match the filename pattern agreed with client
*  transfer valid files to "inbound" folder on application server
*  delete files on bastion server (optional - the client may want to do this or they may want to leave the files)
*  create log file with results of connection/transfer
*  email log file to client

Cheers,

PaulStart Free Trial
[+][-]07.16.2008 at 07:03AM PDT, ID: 22016000

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, SSH / Telnet Software, Windows Batch Scripting
Tags: VB Script
Sign Up Now!
Solution Provided By: Shift-3
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628