this example code demonstrates how to upload files using componentpro sftp library
// Create a new instance.
Ftp client = new Ftp();
// Connect to the FTP server.
client.Connect("localhost");
// Authenticate.
client.Authenticate("test", "test");
// ...
// Get all directories, subdirectories, and files from remote folder '/myfolder' to 'c:\myfolder'.
client.DownloadFiles("/myfolder", "c:\\myfolder");
// Get all directories, subdirectories, and files that match the specified search pattern from remote folder '/myfolder2' to 'c:\myfolder2'.
client.DownloadFiles("/myfolder2", "c:\\myfolder2", "*.cs");
// or you can simply put wildcard masks in the source path, our component will automatically parse it.
// download all *.css files from remote folder '/myfolder2' to local folder 'c:\myfolder2'.
client.DownloadFiles("/myfolder2/*.css", "c:\\myfolder2");
// Download *.cs and *.vb files from remote folder '/myfolder2' to local folder 'c:\myfolder2'.
client.DownloadFiles("/myfolder2/*.cs;*.vb", "c:\\myfolder2");
// Get files in the folder '/myfolder2' only.
TransferOptions opt = new TransferOptions(true, false, false, (SearchCondition)null, FileExistsResolveAction.OverwriteAll, SymlinksResolveAction.Skip, false);
client.DownloadFiles("/myfolder2", "c:\\myfolder2", opt);
// ...
// Disconnect.
client.Disconnect();
I think I've seen this code somewhere a few times already. You can refer to this website, they provide software solutions in many different areas along with the full illustrations:
ReplyDeletehttps://www.atp-inc.net/products/sftp
https://www.codeultimate.com/products/sftp
There are some other tools that also support FTPS very strongly, you can refer to:
ReplyDelete- https://www.atp-inc.net/
- https://www.codeultimate.com/
- https://www.componentpro.com/
Hi, can you give me a clear way to check the file checksum after upload to FTP Server ? Many thanks
ReplyDelete