Sending the ListDirectory
to an FTP server but returns the first 2000 items from the FTP only. Adding SSL did not return more results.
Is there another library I should be using to get the full results?
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(OnValidateCertificate);
ServicePointManager.Expect100Continue = true;
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://XXXX");
request.Method = WebRequestMethods.Ftp.ListDirectory;
request.Credentials = new NetworkCredential("User", "Password");
request.EnableSsl = true;
ServicePoint sp = request.ServicePoint;
Console.WriteLine("ServicePoint connections = {0}.", sp.ConnectionLimit);
sp.ConnectionLimit = 1;
using (var response = (FtpWebResponse)request.GetResponse())
{
using (var stream = response.GetResponseStream())
{
using (var reader = new StreamReader(stream, true))
{
string line = reader.ReadLine();
while (line != null)
{
ListFiles.Add(line);
line = reader.ReadLine();
}
}
}
}
This is apparently a configuration issue on the server. See the following articles:
http://www.inmotionhosting.com/support/website/general-server-setup/incrrease-file-display-limit
Viewing more than 10,000 files on a FTP file server?
Basically, these articles recommend either changing the server configuration to allow you to view more files or sorting the files into more narrow directories so you can be more selective about which ones you want to view at any given time.