Hi,Im trying to get csv files from ftp to local but its not downloading .It goes into while loop shows all files how to write local folder file any suggetions.class Program
{ static void Main(string[] args)
{
string localPath = @"C:\Workspace\";
List<string> dirListing = new List<string>();
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftp://172.32.1.252:5012/Test/Rudin);
request.Credentials = new NetworkCredential("local", "Password1");
request.Method = WebRequestMethods.Ftp.ListDirectory; StreamReader streamReader = new StreamReader(request.GetResponse().GetResponseStream());
string fileName3 = streamReader.ReadLine();
while (fileName3 != null && fileName3 != "Rudin")
dirListing.Add(fileName3); fileName3 = streamReader.ReadLine();
} request = null;
// streamReader = null;
//FileStream responseStream =null;
#region Locl
int Length = 10000;
Byte[] buffer = new Byte[Length];
// int bytesRead = responseStream.Read(buffer, 0, Length);
int bytesRead = 0;
// Stream reader = request.GetResponse().GetResponseStream(fileName3);
for (int i = 2; i < dirListing.Count; i++)
{ FileStream fileStream = new FileStream("C://Workspace/ex.csv" , FileMode.Create);
while (true) {
// bytesRead = streamReader.Read(buffer, 0, buffer.Length);
if (bytesRead == 0) break; fileStream.Write(buffer, 0, bytesRead);
}
fileStream.Close();