这里我迄今为止所做的事情:
FtpWebRequest reqFTP;
string returnString = "";
Uri serverFile = new Uri(ftpServer + "/" + dirName);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(serverFile);
reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPass);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
returnString += System.Text.ASCIIEncoding.ASCII.GetString(buffer);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
这样做的似乎是把我从目录中所有档案的细节来看,采用一种格式。 能否仅仅获得一个单一档案(根据创建日期等标准),或者是否有一个图书馆将这种描述留给我?