Class FtpHelper
Helper methods for FTP operations
public static class FtpHelper
- Inheritance
-
FtpHelper
- Inherited Members
Methods
GetDirectories(List<string>)
Extracts directory names from FTP entries list
public static IList<string> GetDirectories(List<string> ftpEntries)
Parameters
Returns
IsFile(string)
Determines if FTP entry is file, folder, or link
public static FileSystemType IsFile(string entry)
Parameters
entrystringFTP directory entry
Returns
- FileSystemType
File system type
IsFile(string, out string)
Determines if FTP entry is file, folder, or link and extracts file name
public static FileSystemType IsFile(string entry, out string fileName)
Parameters
Returns
- FileSystemType
File system type
IsFile(string, out string, out long)
Determines if FTP entry is file, folder, or link and extracts file name and length
public static FileSystemType IsFile(string entry, out string fileName, out long length)
Parameters
entrystringFTP directory entry (format: drw-rw-rw- 1 user group 0 Nov 21 18:03 App_Data)
fileNamestringExtracted file/folder name
lengthlongFile length in bytes
Returns
- FileSystemType
File system type
IsFileOnHosting(string, List<string>, long)
Checks if file with given name and length exists on FTP hosting
public static bool IsFileOnHosting(string localFilePath, List<string> ftpEntries, long fileLength)
Parameters
localFilePathstringLocal file path
ftpEntriesList<string>List of FTP directory entries
fileLengthlongFile length to compare
Returns
- bool
True if file with same name and length exists on hosting
IsSchemaFtp(string)
Checks if string starts with FTP schema (ftp://)
public static bool IsSchemaFtp(string path)
Parameters
pathstringPath to check
Returns
- bool
True if path starts with ftp://
IsThisOrUp(string)
Checks if folder name is current directory (.) or parent directory (..)
public static bool IsThisOrUp(string folderName)
Parameters
folderNamestringFolder name to check
Returns
- bool
True if folder is . or ..
ReplaceSchemaFtp(string)
Removes FTP schema prefix from hostname
public static string ReplaceSchemaFtp(string remoteHost)
Parameters
remoteHoststringRemote host with or without ftp:// prefix
Returns
- string
Host without ftp:// prefix