/// <summary> /// Return a detailed directory listing /// </summary> /// <param name="directory">Directory to list, e.g. /pub/etc</param> /// <returns>An FTPDirectory object</returns> public FTPdirectory ListDirectoryDetail(string directory) { System.Net.FtpWebRequest ftp = GetRequest(GetDirectory(directory)); //Set request to do simple list ftp.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails; string str = GetStringResponse(ftp); //replace CRLF to CR, remove last instance str = str.Replace("\r\n", "\r").TrimEnd('\r'); //split the string into a list FTPdirectory ftpDir = new FTPdirectory(str, _lastDirectory, this._hostname); return(ftpDir); }
//internal: share use function for GetDirectories/Files private FTPdirectory GetFileOrDir(FTPfileInfo.DirectoryEntryTypes type, string ext) { FTPdirectory result = new FTPdirectory(); foreach (FTPfileInfo fi in this) { if (fi.FileType == type) { if (ext == "") { result.Add(fi); } else if (ext == fi.Extension) { result.Add(fi); } } } return(result); }