List<string> dirs = FileHelper.GetFilesRecursive(@"C:<source directory>");foreach (string p in dirs){StringBuilder builder = new StringBuilder(p);//remove leading directory info and reverse slashesbuilder.Remove(0, 38); builder.Replace('\\', '/');FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://<server IP>" + builder);//StringBuilder builder2 = new StringBuilder("ftp://<server IP>" + builder);//writer.WriteLine(builder2);request.Timeout = 10000;request.ReadWriteTimeout = 10000;request.UseBinary = true;request.KeepAlive = true;request.Method = WebRequestMethods.Ftp.UploadFile;FileInfo uploadFile = new FileInfo(p);request.ContentLength = uploadFile.Length;int buffLength = 2048;byte[] buff = new byte[buffLength];int contLength;FileStream fStream = uploadFile.OpenRead();Stream requestWriter = request.GetRequestStream();contLength = fStream.Read(buff, 0, buffLength);while (contLength != 0){requestWriter.Write(buff, 0, buffLength);contLength = fStream.Read(buff, 0, buffLength);}requestWriter.Close();fStream.Close();}