- First download SSH.NET library
- From VS 2013, right click "Reference" and select "Manage NuGet Packages..."
- Search for "SSH" and you'll see "SSH.NET" as an option.
- Click "Install" and it will add a reference called "Renci.Ssh.Net"
- In your .proj, add a class file.
- Sample code: public class FtpHelper
{
public FtpHelper() { }
public void GetFile(string host, string username, string password){
SftpClient sftpClient = new SftpClient(host, username, password);sftpClient.Connect();List<SftpFile> fileList = sftpClient.ListDirectory("/outgoing/test").ToList();
if (fileList != null && fileList.Count() > 2)
{
for (int i = 2; i < fileList.Count(); i++){string destinationFile = "C:\\" + fileList[i].Name;using (var stream = new FileStream(destinationFile, FileMode.Create)){sftpClient.DownloadFile(fileList[i].FullName, stream);stream.Close();}}}
sftpClient.Disconnect();}
- Unit Test
[TestMethod]
public void GetFileTest_JHGA_PickUpTestSite_ReturnNoError()
{
FtpHelper ftp = new FtpHelper();
ftp.GetFile("ftp.yoursite.com", "yourusername", "yourPassword");
}
- Done!
alwaysbecoding
Thursday, April 10, 2014
Using SSH.NET Getting a list of files from ftp server
Friday, August 23, 2013
Setting the target framework in C++ Projects
Setting the target framework in C++ Projects
If you need to change the target framework in C++ projects,
you actually need to manually change the .vcxproj file.
Right click the project file and select unload
Add “<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>”
Example:
<PropertyGroup Label="Globals">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
Save and close the .vcsproj file
Right click the project and select “Reload Project”
Reference:
Subscribe to:
Posts (Atom)
Using SSH.NET Getting a list of files from ftp server
First download SSH.NET library From VS 2013, right click "Reference" and select "Manage NuGet Packages..." Search fo...
-
First download SSH.NET library From VS 2013, right click "Reference" and select "Manage NuGet Packages..." Search fo...
-
Setting the target framework in C++ Projects If you need to change the target framework in C++ projects, you actually need to manuall...