Table of Contents

Class FtpHelper

Namespace
SunamoFtp.Base
Assembly
SunamoFtp.dll

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

ftpEntries List<string>

List of FTP directory entries

Returns

IList<string>

List of directory names

IsFile(string)

Determines if FTP entry is file, folder, or link

public static FileSystemType IsFile(string entry)

Parameters

entry string

FTP 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

entry string

FTP directory entry

fileName string

Extracted file/folder name

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

entry string

FTP directory entry (format: drw-rw-rw- 1 user group 0 Nov 21 18:03 App_Data)

fileName string

Extracted file/folder name

length long

File 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

localFilePath string

Local file path

ftpEntries List<string>

List of FTP directory entries

fileLength long

File 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

path string

Path 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

folderName string

Folder 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

remoteHost string

Remote host with or without ftp:// prefix

Returns

string

Host without ftp:// prefix