I am thinking of using following code, but I want to transfer hundreds of files and it does not look viable to connect and then disconnect on every file transfer.
request = (FtpWebRequest) FtpWebRequest.Create(FtpAddress + file);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(User, Pass);
request.UsePassive = IsPassive;
request.UseBinary = true;
request.KeepAlive = false;
FileStream fs = File.OpenRead("");
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Stream ftpStream = request.GetRequestStream();
ftpStream.Write(buffer, 0, buffer.Length);
ftpStream.Close();
What options do I have for uploading all of these files using a single connection?