Topic "Needing help scripting an auto download from a SFTP in C#"

Author Message
deadpanpython
[View user's profile]

Joined: 2014-07-10
Posts: 1
Location: Pensacola
Hey everyone! I am needing some help to make a C# script to run an auto download from our SFTP. I did find this link http://winscp.net/eng/docs/library and the C# example is my template that I'm using. I do have a few questions on the code though. It has it uploading files while I'm needing the opposite. Would I need to change "transferResult = session.PutFiles" to "transferResult = session.GetFiles" ?

Also with the SshHostKeyFingerprint since I do not have the fingerprint is there a way I just bypass that? I saw in another forum post how you were able to bypass it using powershell.

And also how do I add a specialized port number to be able to connect to the SFTP?

Also how would I go about scheduling a time to run say a nightly download? Is that a Windows Scheduler thing that I would have to set up in windows?

I do appreciate it guys! I am new to coding and just trying to get my orientation with all of this. Any help you can give I would greatly appreciate it!
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
deadpanpython wrote:
It has it uploading files while I'm needing the opposite. Would I need to change "transferResult = session.PutFiles" to "transferResult = session.GetFiles" ?

Correct, use Session.GetFiles:
http://winscp.net/eng/docs/library_session_getfiles

Quote:
Also with the SshHostKeyFingerprint since I do not have the fingerprint is there a way I just bypass that? I saw in another forum post how you were able to bypass it using powershell.

You need to have the fingerprint.
See https://winscp.net/eng/docs/faq_hostkey

Quote:
And also how do I add a specialized port number to be able to connect to the SFTP?

Use SessionOptions.PortNumber:
http://winscp.net/eng/docs/library_sessionoptions

Quote:
Also how would I go about scheduling a time to run say a nightly download? Is that a Windows Scheduler thing that I would have to set up in windows?

Yes. For scheduling see:
http://winscp.net/eng/docs/guide_schedule
Note that it deals with scheduling WinSCP script, not a C# application. So just replace WinSCP.exe executable with your application.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License