Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, July 29, 2019 12:32 PM
Hi,
I'm trying to figure it out some kind of solution for SSH/SFTP upload. Everything i need is to be able to use Windows Task scheduler to run and upload something.
But there is just so much out there, I am not sure were to start. Everything seem so overwhelming.
Can you guys show me where I should start ?
All replies (2)
Monday, July 29, 2019 1:04 PM âś…Answered
Hi,
You can create a simple .NET C# Console Application, add the SSH.NET NuGet package and look at https://github.com/sshnet/SSH.NET/ for some samples on how to actually upload files.
Kind regards,
Johnny Hooyberghs
Tuesday, July 30, 2019 2:33 AM
For using SSH and relative protocols: SSH.NET Library
If commercial tools are on your consideration list, you may want to take a look at the Ultimate SFTP
// Create a new instance.
Sftp client = new Sftp();
// Connect to the SFTP server.
client.Connect("localhost");
// Authenticate.
client.Authenticate("test", "test");
// ...
// Upload all files and subdirectories from local folder 'c:\temp' to the remote dir '/temp'
client.UploadFiles("c:\\temp", "/temp");
// Upload all directories, subdirectories, and files that match the specified search pattern from local folder 'c:\myfolder2' to remote folder '/myfolder2'.
client.UploadFiles("c:\\myfolder2", "/myfolder2", "*.cs");
// or you can simply put wildcard masks in the source path, our component will automatically parse it.
// upload all *.css files from local folder 'c:\myfolder2' to remote folder '/myfolder2'.
client.UploadFiles("c:\\myfolder2\\*.css", "/myfolder2");
// Upload *.cs and *.vb files from local folder 'c:\myfolder2' to remote folder '/myfolder2'.
client.UploadFiles("c:\\myfolder2\\*.cs;*.vb", "/myfolder2");
// ...
// Disconnect.
client.Disconnect();
Take a look at this example