Reference TFtpClient
Declared in Codebot.Networking.Ftp.pas on line 76
TFtpClient provides access to an ftp client Remarks This class provides strictly synchronous operations
TFtpClient = class(TObject)
protected
{ Invoke the OnProgress event }
procedure DoProgress(const Size, Transmitted: LargeWord); virtual;
public
{ Create a new file transfer object }
constructor Create;
{ Disconnect and destroy the file transfer object }
destructor Destroy; override;
{ Attempt to open a file transfer connection using the host, port, username,
and password }
function Connect: Boolean;
{ Close any opened connection }
procedure Disconnect;
{ Cancel any ongoing transfers }
procedure Cancel;
{ Returns the current remote directory }
function GetCurrentDir: string;
{ Returns true if a remote directory exists }
function DirExists(const Dir: string): Boolean;
{ Change to a new current remote directory }
function ChangeDir(const Dir: string): Boolean;
{ Create a new remote directory }
function MakeDir(const Dir: string): Boolean;
{ Delete an existing remote directory }
function RemoveDir(const Dir: string): Boolean;
{ Delete an existing remote file }
function FileDelete(const FileName: string): Boolean;
{ Returns true if a remote file exists }
function FileExists(const FileName: string): Boolean;
{ Rename a remote file, works with directories too }
function FileRename(const OldName, NewName: string): Boolean;
{ Retrieve the size of a remote file }
function FileSize(const FileName: string): LargeWord;
{ Retrieve the modified date of a remote file }
function FileDate(const FileName: string): TDateTime;
{ Initiate a file upload to the remote server }
function FilePut(const LocalFile, RemoteFile: string; Overwrite: Boolean = True): Boolean;
{ Request a file download from the remote server }
function FileGet(const RemoteFile, LocalFile: string; Overwrite: Boolean = True): Boolean;
{ Retrieve a text mode listing of files and folders }
function FileList(const Path: string = ''): string;
{ Initiate a structured listing of files and folders with an optional
attribute mask }
function FindFirst(const Path: string; out FindData: TRemoteFindData; Allow: TFileSystemAttributes = fsaAny): Boolean;
{ Continue with the next listing started by FindFirst }
function FindNext(out FindData: TRemoteFindData): Boolean;
{ Returns true when connected to a remote server, otherwise acts like
connect and disconnect }
property Connected: Boolean read GetConnected write SetConnected;
{ The name of the host to resolve when connecting }
property Host: string read FHost write FHost;
{ The port used for issuing ftp commands, defaults to 21 }
property Port: Word read FPort write FPort;
{ The username used when connecting, defaults to anonymous }
property UserName: string read FUserName write FUserName;
{ The password used when connecting, defaults to an email address }
property Password: string read FPassword write FPassword;
{ An event invoked echoing ftp commands issued by the client }
property OnCommand: TTextEvent read FOnCommand write FOnCommand;
{ An event invoked when responses are read from the remote server }
property OnResponse: TTextEvent read FOnResponse write FOnResponse;
{ An event continuously invoked as file transfers occur }
property OnProgress: TTransmitEvent read FOnProgress write FOnProgress;
end;See also
LargeWord in Codebot.System.pas
TTransmitEvent in Codebot.Networking.pas