Count number of files on FTP server [duplicate]
Solution 1:
With the WinSCP .NET assembly, just use the Session.EnumerateRemoteFiles
method and call the Count
extension method on the result:
var path = "/remote/path";
var files = session.EnumerateRemoteFiles(path, "*.zip", EnumerationOptions.None);
int count = files.Count();
See also Using WinSCP .NET Assembly from SQL Server Integration Services (SSIS).