Ftp2 Go Reference Documentation

Ftp2

Current Version: 11.5.0

Chilkat.Ftp2

Connect, secure, transfer, synchronize, and manage files on FTP servers.

Chilkat.Ftp2 is a comprehensive FTP and FTPS client class for applications that need reliable file transfer and remote file management. It supports connection setup, explicit and implicit TLS, passive and active data connections, uploads, downloads, directory listings, recursive operations, synchronization, proxy traversal, credential protection, and detailed diagnostics.

FTP and FTPS connections

Connect using plain FTP, explicit TLS, or implicit TLS, with control over ports, timeouts, passive mode, and IPv4/IPv6 behavior.

Upload and download files

Transfer files, text, binary data, streams, and in-memory content, with support for resume, append, and progress monitoring.

Remote file management

List directories, create and remove folders, rename files, delete files, inspect sizes and timestamps, and manage remote paths.

Recursive and sync operations

Upload or download directory trees, mirror folders, and synchronize local and remote content.

Security and credentials

Use TLS options, client certificates, secure password handling, and secret-backed credential references where appropriate.

Diagnostics and TLS details

Use LastErrorText, session logs, directory listings, and TLS negotiation details to troubleshoot server behavior.

Tip: For FTPS troubleshooting, inspect the detailed diagnostic output and, when available, the last JSON data describing the TLS negotiation, certificate validation, protocol version, and related connection details.

Object Creation

ftp := chilkat.NewFtp2()
...
ftp.DisposeFtp2()

Properties

AbortCurrent
func (ftp *Ftp2) AbortCurrent() bool
func (ftp *Ftp2) SetAbortCurrent(b bool)
Introduced in version 9.5.0.58

Set to true to request cancellation of the operation currently running on this object. Long-running network and file-transfer methods periodically check this property; methods that complete quickly may finish before the request is observed.

A synchronous call can be cancelled from another thread by setting this property on the same object. The property is reset to false after cancellation is processed, and a stale request is cleared when a later method begins.

Cancellation behavior: Treat this as a cancellation request, not a guarantee of immediate termination. Use the method's normal return value and diagnostic properties to determine the outcome.

top
Account
func (ftp *Ftp2) Account() string
func (ftp *Ftp2) SetAccount(s string)

Very rarely needed today: Almost all modern FTP servers rely exclusively on the USER and PASS commands for authentication and access control.

The ACCT command is a legacy feature from early computing systems that sometimes required a separate account code for billing or resource allocation. Today, those details are usually associated directly with the user's server-side profile, making ACCT obsolete for most applications. Leave this property empty unless the server administrator or login instructions explicitly require an FTP account value.

Specifies the FTP account string sent with the ACCT command when a server requires an account in addition to the username and password.

top
ActivePortRangeEnd
func (ftp *Ftp2) ActivePortRangeEnd() int
func (ftp *Ftp2) SetActivePortRangeEnd(v int)

Specifies the last local TCP port that may be used for active-mode data connections. The default is 0. Valid nonzero values are 1 through 65535.

The range beginning with ActivePortRangeStart is inclusive. If ActivePortRangeStart is 0, this property is ignored and the operating system chooses an ephemeral listening port. If this value is 0 or is less than ActivePortRangeStart, Chilkat behaves as though both endpoints equal ActivePortRangeStart.

Unavailable ports are skipped. Chilkat tries each port in the effective range until binding succeeds, and fails only after all ports have been tried. The range applies to both PORT and EPRT and may be changed while the control connection is already established.

Active mode setting: This property is used only when Passive is false. Passive mode is typically preferred because it avoids the server-initiated connection back to the client that many client-side firewalls block. When active mode is required, any fixed port range must be allowed by the client-side firewall and reachable through intervening NAT.

top
ActivePortRangeStart
func (ftp *Ftp2) ActivePortRangeStart() int
func (ftp *Ftp2) SetActivePortRangeStart(v int)

Specifies the first local TCP port that may be used for active-mode data connections. The default is 0. Valid nonzero values are 1 through 65535.

When this property is 0, ActivePortRangeEnd is ignored and Chilkat binds the listening socket to port 0, allowing the operating system to choose an available ephemeral port. When this property is nonzero, the effective range is inclusive. If the ending value is 0 or is less than the starting value, Chilkat tries only the starting port.

For each active-mode data connection, Chilkat tries the ports in the effective range in ascending order, skipping any port for which the listening socket cannot be bound. The operation fails only after every port in the range has been tried.

Scope: The range applies to both PORT and EPRT operation and may be changed after the FTP control connection has been established.
Active mode setting: This property is used only when Passive is false. Passive mode is typically preferred because the client initiates both the control and data connections, making it much friendlier to client-side firewalls and NAT.

top
AllocateSize
func (ftp *Ftp2) AllocateSize() uint
func (ftp *Ftp2) SetAllocateSize(v uint)

Rarely needed: The FTP ALLO command pre-allocates disk space on the server before an upload. It is generally needed only by certain legacy systems, such as older mainframes, that require the exact file size in advance to reserve storage. Most modern FTP servers allocate space dynamically and either ignore ALLO or do not require it. Leave this property at its default value of 0 unless the server explicitly requires pre-allocation.

Specifies the size, in bytes, to send in an ALLO command before the next upload. For example, a value of 20 sends ALLO 20. The default value of 0 disables the command.

This is a one-shot setting. It is consumed by the next applicable upload and automatically reset to 0. A successful FTP reply indicating that allocation is unnecessary, such as reply code 202, does not prevent the upload from continuing.

ALLO asks the server to reserve storage for the incoming file. Some specialized or quota-managed servers require the allocation request before accepting the transfer.

top
AllowMlsd
func (ftp *Ftp2) AllowMlsd() bool
func (ftp *Ftp2) SetAllowMlsd(b bool)
Introduced in version 9.5.0.50

Controls whether machine-readable directory listings are requested with MLSD when the server advertises support. The default is true.

When this property is true and MLSD is advertised, Chilkat uses MLSD. Otherwise, a legacy listing is used: NLST when PreferNlst is true, or LIST when it is false.

MLSD provides standardized facts such as type, size, and modification time and is generally more reliable than parsing server-specific LIST output. Facts not supplied by the server remain unavailable. When a perm fact is present, GetPermissions returns it rather than a UNIX-style permission string.

Recommended setting: Keep this property enabled unless a particular server has a broken MLSD implementation. Disabling it can reduce the accuracy or availability of timestamps, sizes, and other listing information.

More Information and Examples
top
AuthSsl
func (ftp *Ftp2) AuthSsl() bool
func (ftp *Ftp2) SetAuthSsl(b bool)

Legacy and very uncommon: AUTH SSL originated in early FTP security drafts from the era when SSL was the standard encryption protocol. For modern FTP servers, use AuthTls instead. Most security-conscious servers require AUTH TLS and may reject AUTH SSL to enforce current security policies and prevent protocol downgrades. This property is normally needed only for a decades-old legacy server that was never updated to support AUTH TLS.
Set to true to use explicit FTP over TLS by sending AUTH SSL on the FTP control channel. The client first establishes a plain FTP control connection, receives the server greeting, and then upgrades that connection to TLS.

The TLS upgrade is completed before USER and PASS are sent. ConnectOnly performs the explicit TLS upgrade but does not log in. During Connect, Chilkat sends PBSZ and PROT as required by DataProtection. If the server responds with 530 Please login with USER and PASS, Chilkat logs in and automatically retries those commands.

If the server accepts the AUTH command but rejects a required PBSZ or PROT command, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.

AUTH SSL is the alternative explicit-TLS command used by this property. If Ssl is true, implicit TLS takes priority. If both this property and AuthTls are true while Ssl is false, AuthTls takes priority and Chilkat sends AUTH TLS.

More Information and Examples
top
AuthTls
func (ftp *Ftp2) AuthTls() bool
func (ftp *Ftp2) SetAuthTls(b bool)

Set to true to use explicit FTP over TLS by sending AUTH TLS on the FTP control channel. The client first establishes a plain FTP control connection, receives the server greeting, and then upgrades that connection to TLS. Port 21 is conventionally used.

The TLS upgrade is completed before USER and PASS are sent. ConnectOnly performs the explicit TLS upgrade but does not log in. During Connect, Chilkat sends PBSZ and PROT as required by DataProtection. If the server responds with 530 Please login with USER and PASS, Chilkat logs in and automatically retries those commands.

If the server accepts the AUTH command but rejects a required PBSZ or PROT command, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.

If Ssl is true, implicit TLS takes priority and this property is ignored. If both AuthTls and AuthSsl are true while Ssl is false, AuthTls takes priority.

AuthTls versus AuthSsl: Both properties select explicit FTPS. Their only difference is the command sent to initiate TLS: AUTH TLS for this property and AUTH SSL for AuthSsl.

top
AutoFeat
func (ftp *Ftp2) AutoFeat() bool
func (ftp *Ftp2) SetAutoFeat(b bool)

Rarely changed: Leave this property at its default value of true for nearly all modern FTP servers. The FEAT command was standardized in RFC 2389 in 1998 and is broadly supported by mainstream FTP software, including FileZilla Server, vsftpd, ProFTPD, and IIS. Set it to false only for a legacy or nonconforming server that mishandles FEAT.
Controls whether a FEAT command is sent automatically after login. The default is true. The response is processed to detect capabilities such as MLSD, UTF8, EPSV, MODE Z, and server-specific extensions.

When AutoSyst is also true, automatic SYST is sent first. If UTF8 is advertised and AutoOptsUtf8 is true, capability processing is followed by OPTS UTF8 ON.

The same capability processing can be performed later by calling Feat explicitly.

top
AutoFix
func (ftp *Ftp2) AutoFix() bool
func (ftp *Ftp2) SetAutoFix(b bool)

Controls automatic adjustment of Ssl, AuthSsl, and AuthTls based solely on Port. The default is true. The only recognized ports are 21 and 990.

PortAutomatic adjustment
21Sets Ssl to false. AuthTls and AuthSsl continue to determine whether explicit TLS is requested.
990Sets Ssl to true and sets AuthTls and AuthSsl to false.
Any other portMakes no changes because the intended plain, explicit-TLS, or implicit-TLS mode cannot be inferred from a custom port number.
Scope: AutoFix does not probe the server or resolve arbitrary conflicting settings. It only applies the conventional meaning of ports 21 and 990.

top
AutoGetSizeForProgress
func (ftp *Ftp2) AutoGetSizeForProgress() bool
func (ftp *Ftp2) SetAutoGetSizeForProgress(b bool)

Controls whether Chilkat sends a SIZE command before a download so percentage-based progress can be calculated. The default is false. Each size query adds a control-channel round trip.

A nonzero one-shot value in ProgressMonSize or ProgressMonSize64 supplies the expected size directly and avoids this additional query. Even when this property is false, percentage progress may be available if the server includes a usable size in its preliminary transfer reply.

top
AutoOptsUtf8
func (ftp *Ftp2) AutoOptsUtf8() bool
func (ftp *Ftp2) SetAutoOptsUtf8(b bool)
Introduced in version 9.5.0.47

Controls whether OPTS UTF8 ON is sent automatically when a processed FEAT response advertises UTF8. The default is true. When UTF-8 is advertised, Chilkat sets CommandCharset and DirListingCharset to utf-8, overwriting values previously assigned by the application.

If UTF8 is not advertised, the existing charset property values are left unchanged. This behavior applies both during automatic capability discovery and when Feat is called explicitly.

Set to false for a server that advertises UTF-8 but rejects the option or uses a different encoding in practice.

top
AutoSetUseEpsv
func (ftp *Ftp2) AutoSetUseEpsv() bool
func (ftp *Ftp2) SetAutoSetUseEpsv(b bool)
Introduced in version 9.5.0.44

Recommended setting: Applications should set this property to true. The default is false in current versions, but will change to true in Chilkat v12.0.0.

EPSV is preferred on modern networks because it supports both IPv4 and IPv6, whereas PASV cannot represent an IPv6 address. It is also more reliable through NAT and firewalls because the EPSV reply contains only a port number and relies on the address of the existing control connection. In contrast, a PASV reply includes an IP address, which can fail when a server behind NAT returns its private internal address.

Virtually all modern FTP servers, including vsftpd, ProFTPD, FileZilla Server, and IIS, support EPSV. It was standardized in RFC 2428 in 1998 and is widely implemented.

Controls whether UseEpsv is recalculated when server capabilities are processed. The default is false. Processing occurs during the initial connection when AutoFeat is true, or when Feat is called explicitly.

The result is based on both the advertised capabilities and the connection context; it is not simply a copy of whether EPSV appears in the FEAT reply. For example, an IPv4 connection may retain UseEpsv = FALSE even when the server advertises EPSV. Automatic recalculation can overwrite an explicitly assigned value, and each new connection recalculates it for the new session.

If an attempted EPSV command is rejected, Chilkat falls back to PASV for that data connection. The failed attempt is not remembered as a session-wide reason to disable future EPSV attempts.

top
AutoSyst
func (ftp *Ftp2) AutoSyst() bool
func (ftp *Ftp2) SetAutoSyst(b bool)

Controls whether a SYST command is sent automatically after login. The default is true. The server's operating-system type can help Chilkat interpret legacy LIST output and other server-specific behavior.

When both this property and AutoFeat are true, automatic SYST occurs before automatic FEAT.

Set to false only when a particular server rejects or mishandles SYST.

top
AutoXcrc
func (ftp *Ftp2) AutoXcrc() bool
func (ftp *Ftp2) SetAutoXcrc(b bool)

Controls automatic post-upload verification with the server-specific XCRC command. The default is false. When enabled and the server supports XCRC, Chilkat requests a CRC after an upload and treats a mismatch as transfer failure.

If XCRC support is not detected, Chilkat does not send the verification command and the upload proceeds normally. This extension is not part of the core FTP standard and is not supported by every server. Capability detection normally depends on a processed FEAT response.

Integrity scope: CRC verification can detect accidental corruption in transit or storage, but it is not a cryptographic authenticity check.

top
BandwidthThrottleDown
func (ftp *Ftp2) BandwidthThrottleDown() int
func (ftp *Ftp2) SetBandwidthThrottleDown(v int)

Specifies the approximate maximum download rate in bytes per second. The default value of 0 disables throttling.

Client-side download throttling is approximate because the server continues sending as permitted by TCP. The operating system's socket buffers absorb data between reads, so very small transfers may complete before the configured rate can be meaningfully enforced.

More Information and Examples
top
BandwidthThrottleUp
func (ftp *Ftp2) BandwidthThrottleUp() int
func (ftp *Ftp2) SetBandwidthThrottleUp(v int)

Specifies the approximate maximum upload rate in bytes per second. The default value of 0 disables throttling.

The limit is averaged over the transfer. Very small uploads may complete before the configured rate can be closely approximated.

More Information and Examples
top
ClientIpAddress
func (ftp *Ftp2) ClientIpAddress() string
func (ftp *Ftp2) SetClientIpAddress(s string)

This property is normally left unset. Set it only on a multihomed computer when the application must bind the outgoing connection to a specific local network interface.

Specify a numeric IPv4 or IPv6 address, not a hostname. When the property is empty, the operating system automatically chooses the local address.

More Information and Examples
top
CommandCharset
func (ftp *Ftp2) CommandCharset() string
func (ftp *Ftp2) SetCommandCharset(s string)

Specifies the character encoding used by high-level FTP operations for commands containing non-ASCII text, including remote paths and filenames. The default is ANSI. Charset names and the keyword ANSI are case-insensitive. An unrecognized charset name is clamped to utf-8, and the getter returns utf-8.

Usually changed automatically to UTF-8: Although the default value is ANSI, when the server advertises UTF-8 and AutoOptsUtf8 is enabled, Chilkat automatically changes this property to utf-8. Nearly all modern FTP servers support UTF-8, so utf-8 is typically the effective value after connecting. If UTF-8 is not advertised, the existing value is left unchanged.
What ANSI means: It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples include windows-1252 on Western-language Windows systems, windows-1251 for Cyrillic, windows-1256 for Arabic, and windows-932 (Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding is utf-8. The actual encoding therefore depends on the computer on which the application runs.

Changing this property after connecting affects subsequent high-level FTP commands. If a character cannot be represented in a selected single-byte encoding, the character is omitted from the transmitted command; use utf-8 to preserve full Unicode names.

FTP filename encoding: The original FTP protocol did not define one universal encoding for path names. The client and server must use the same encoding; UTF-8 is preferred when the server supports it.

top
ConnectFailReason
func (ftp *Ftp2) ConnectFailReason() int

Contains a numeric reason code after Connect or ConnectOnly fails. Use this value for broad classification and inspect LastErrorText for detailed diagnostics.

CodeMeaning
0Success.
1The hostname is empty.
2DNS lookup failed.
3DNS lookup timed out.
4Cancelled by the application.
5Internal failure.
6TCP connection timed out.
7TCP connection was rejected or otherwise failed.
100Internal TLS failure.
101Failed to send the TLS ClientHello.
102An unexpected TLS handshake message was received.
103Failed to read the ServerHello.
104The server did not provide a certificate.
105Unexpected TLS protocol version.
106Server certificate verification failed.
107The negotiated TLS version is not allowed.
109Failed while reading TLS handshake messages.
110Failed to send the client-certificate handshake message.
111Failed to send the client key exchange.
112The client certificate private key is not accessible.
113Failed to send client certificate verification.
114Failed to send ChangeCipherSpec.
115Failed to send the Finished handshake message.
116The server Finished message is invalid.
200Connected, but the FTP greeting was not received.
201The AUTH TLS or AUTH SSL upgrade failed.
300An asynchronous operation is already in progress.
301FTP authentication failed.

A successful connection sets this property to 0. An authentication failure can set it to 301 while ConnectVerified remains true, because the TCP and FTP connection succeeded before the login was rejected.

top
ConnectTimeout
func (ftp *Ftp2) ConnectTimeout() int
func (ftp *Ftp2) SetConnectTimeout(v int)

Specifies the maximum number of seconds to wait for a remote endpoint to accept a TCP connection. The default is 30. A value of 0 or any negative value waits indefinitely.

This timeout applies whenever Ftp2 establishes a TCP connection, including the FTP control connection, FTP data connections, and connections to configured proxy servers.

It covers only TCP connection establishment. It does not apply to TLS handshakes, FTP greetings or replies, authentication, file data, or any other communication after the TCP connection has been accepted.

top
ConnectVerified
func (ftp *Ftp2) ConnectVerified() bool

Indicates whether the TCP connection to the FTP server was successfully established during the most recent connection attempt. It does not indicate that FTP authentication succeeded; see LoginVerified.

This is a verification result, not a current-socket-state property. It remains true after Disconnect if the preceding connection was successfully established.

top
CrlfMode
func (ftp *Ftp2) CrlfMode() int
func (ftp *Ftp2) SetCrlfMode(v int)

Controls line-ending conversion when downloading in ASCII transfer mode. The default is 0.

ValueDownloaded text
0Leaves line endings as received.
1Converts line endings to CRLF.
2Converts line endings to LF.
3Converts line endings to CR.
Binary mode: This property has no effect on binary transfers. Use binary mode for files whose bytes must be preserved exactly.

top
CurBytesReceived
func (ftp *Ftp2) CurBytesReceived() uint
Introduced in version 11.0.0

Returns the number of bytes received by the current or most recently completed FTP download as a 32-bit unsigned integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

top
CurBytesReceived64
func (ftp *Ftp2) CurBytesReceived64() int64
Introduced in version 11.0.0

Returns the number of bytes received by the current or most recently completed FTP download as a 64-bit integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

top
CurBytesReceivedStr
func (ftp *Ftp2) CurBytesReceivedStr() string
Introduced in version 11.0.0

Returns the number of bytes received by the current or most recently completed FTP download as a decimal string. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

top
CurBytesSent
func (ftp *Ftp2) CurBytesSent() uint
Introduced in version 11.0.0

Returns the number of bytes sent by the current or most recently completed FTP upload as a 32-bit unsigned integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

top
CurBytesSent64
func (ftp *Ftp2) CurBytesSent64() int64
Introduced in version 11.0.0

Returns the number of bytes sent by the current or most recently completed FTP upload as a 64-bit integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

top
CurBytesSentStr
func (ftp *Ftp2) CurBytesSentStr() string
Introduced in version 11.0.0

Returns the number of bytes sent by the current or most recently completed FTP upload as a decimal string. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

top
DataProtection
func (ftp *Ftp2) DataProtection() string
func (ftp *Ftp2) SetDataProtection(s string)
Introduced in version 9.5.0.52

Specifies the protection level for FTP data connections. The value is compared case-insensitively. The default is control.

ValueBehavior
controlData connections use the same protection state as the control connection. If the control connection is unencrypted, no PBSZ or PROT commands are sent.
clearData connections are requested as unencrypted. If the control connection is also unencrypted, no PBSZ or PROT commands are sent. If the control connection uses TLS, Chilkat sends PBSZ 0 followed by PROT C. If the server rejects PROT C but accepts PROT P, Chilkat falls back to private data protection.
privateData connections are protected with TLS. For an encrypted control connection, Chilkat sends PBSZ 0 followed by PROT P.

Connect sends the required PBSZ and PROT commands. If the server requires login first and replies with 530 Please login with USER and PASS, Chilkat authenticates and automatically retries them. A required protection setup fails only when no acceptable protection level can be established.

Control and data channels: FTP uses one long-lived control connection and a separate data connection for each listing, upload, or download. FTPS can protect these channels independently.

top
DebugLogFilePath
func (ftp *Ftp2) DebugLogFilePath() string
func (ftp *Ftp2) SetDebugLogFilePath(s string)

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

More Information and Examples
top
DirListingCharset
func (ftp *Ftp2) DirListingCharset() string
func (ftp *Ftp2) SetDirListingCharset(s string)

Specifies the character encoding used only to decode directory-listing and related server-response bytes. It applies to responses from LIST, NLST, and MLSD. It does not affect commands, remote paths, filenames, usernames, passwords, or other text sent to the server.

The default is ANSI. Charset names and the keyword ANSI are case-insensitive. ANSI means the platform's system-default single-byte encoding or default system locale; on Windows, this is the active code page (ACP).

What ANSI means: It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples include windows-1252 on Western-language Windows systems, windows-1251 for Cyrillic, windows-1256 for Arabic, and windows-932 (Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding is utf-8. The actual encoding therefore depends on the computer on which the application runs.

Using the wrong encoding can produce incorrectly decoded names without causing the listing operation itself to fail. When AutoOptsUtf8 is enabled and UTF-8 support is advertised, Chilkat changes this property to utf-8, even if the application previously assigned another value. If UTF-8 is not advertised, the existing value is left unchanged.

More Information and Examples
top
DownloadTransferRate
func (ftp *Ftp2) DownloadTransferRate() int

Returns the current average download rate in bytes per second. The value is updated during synchronous and asynchronous downloads and describes the download in progress or the most recently completed download. A subsequent upload does not clear the retained download rate.

top
EnableSecrets
func (ftp *Ftp2) EnableSecrets() bool
func (ftp *Ftp2) SetEnableSecrets(b bool)
Introduced in version 11.5.0

Controls automatic resolution of credential values from secure operating-system storage. The default is false. When enabled, supported password properties may contain a secret specification beginning with !! instead of the literal password.

!![appName|]service[|domain]|username

Secret specifications are supported by Password, HttpProxyPassword, ProxyPassword, and SocksPassword. Chilkat resolves them through Windows Credential Manager on Windows or Apple Keychain on macOS.

Credential handling: This feature avoids embedding plaintext credentials in source code or configuration. Access to the secret still depends on the permissions of the process and operating-system account.

More Information and Examples
top
ForcePortIpAddress
func (ftp *Ftp2) ForcePortIpAddress() string
func (ftp *Ftp2) SetForcePortIpAddress(s string)

Specifies the IPv4 address advertised to the server for active-mode data connections. This property affects both PORT and EPRT. Supply a numeric IPv4 address, the keyword control, or an IPv4 address prefixed with bind-. IPv6 values are not accepted. Keywords and prefixes are case-insensitive.

  • control uses the local IPv4 address of the established FTP control socket.
  • bind-192.0.2.10 advertises the address and also binds the local data-listener socket to that address.
  • A plain IPv4 address changes the address sent in PORT or EPRT without explicitly binding the listener to that address.

If ClientIpAddress is set, this property should specify the same local address. When a bind- value is used with ActivePortRangeStart and ActivePortRangeEnd, Chilkat binds to the specified address while searching the effective range for an available port.

Active mode setting: This property is used only when Passive is false. Passive mode is typically preferred because the client initiates both the control and data connections, making it much friendlier to client-side firewalls and NAT.
NAT caution: The advertised address must be reachable from the FTP server. Incorrect active-mode addressing commonly causes the control command to succeed while the subsequent data connection fails.

top
Greeting
func (ftp *Ftp2) Greeting() string

Contains the initial FTP server greeting received for the most recent connection immediately after the TCP or implicit-TLS connection was established. It normally begins with reply code 220 and may include server identification or policy information.

The value remains available after Disconnect.

top
HasModeZ
func (ftp *Ftp2) HasModeZ() bool

Indicates whether the FTP server advertised support for MODE Z, which compresses FTP data streams using the DEFLATE algorithm.

This property becomes meaningful after Chilkat has processed a successful FEAT response, either automatically because AutoFeat is true or through an explicit call to Feat. Before capability discovery, a value of false does not establish that the server lacks MODE Z support.

Call SetModeZ after connecting to enable or disable compressed transfer mode.

top
Hostname
func (ftp *Ftp2) Hostname() string
func (ftp *Ftp2) SetHostname(s string)

Specifies the FTP server hostname or numeric IPv4/IPv6 address. Do not include a URL scheme, path, or port; configure the port separately with Port.

top
HttpProxyAuthMethod
func (ftp *Ftp2) HttpProxyAuthMethod() string
func (ftp *Ftp2) SetHttpProxyAuthMethod(s string)

Specifies the authentication method used with an HTTP proxy. Supported values are Basic and NTLM. Leave empty when the proxy does not require authentication.

top
HttpProxyDomain
func (ftp *Ftp2) HttpProxyDomain() string
func (ftp *Ftp2) SetHttpProxyDomain(s string)

Specifies the Windows domain used for NTLM authentication to the HTTP proxy. It is ignored for Basic authentication and may be left empty when the username already includes the required domain information.

top
HttpProxyHostname
func (ftp *Ftp2) HttpProxyHostname() string
func (ftp *Ftp2) SetHttpProxyHostname(s string)

Specifies the hostname or numeric IP address of an HTTP proxy used to establish the FTP control connection. Leave empty to connect directly.

More Information and Examples
top
HttpProxyPassword
func (ftp *Ftp2) HttpProxyPassword() string
func (ftp *Ftp2) SetHttpProxyPassword(s string)

Specifies the password used to authenticate to the HTTP proxy. It is used together with HttpProxyUsername and HttpProxyAuthMethod.

top
HttpProxyPort
func (ftp *Ftp2) HttpProxyPort() int
func (ftp *Ftp2) SetHttpProxyPort(v int)

Specifies the TCP port of the HTTP proxy. Common values include 8080 and 3128, but the correct value is determined by the proxy configuration.

top
HttpProxyUsername
func (ftp *Ftp2) HttpProxyUsername() string
func (ftp *Ftp2) SetHttpProxyUsername(s string)

Specifies the username used to authenticate to the HTTP proxy. Leave empty when the proxy allows unauthenticated connections.

More Information and Examples
top
IdleTimeoutMs
func (ftp *Ftp2) IdleTimeoutMs() int
func (ftp *Ftp2) SetIdleTimeoutMs(v int)

Specifies the maximum period, in milliseconds, during which no control-channel response or forward upload progress is observed. The default is 60000. A value of 0 or any negative value waits indefinitely.

During an upload, the same limit applies when the operating-system send buffer remains full because the server is not consuming data.

top
IsConnected
func (ftp *Ftp2) IsConnected() bool

Deprecated. Indicates whether the object appears to be connected and authenticated. Reading this property may send NOOP to test the session. Use CheckConnection instead.

top
KeepSessionLog
func (ftp *Ftp2) KeepSessionLog() bool
func (ftp *Ftp2) SetKeepSessionLog(b bool)

Controls collection of an in-memory FTP protocol log. When enabled, commands and server replies are available in SessionLog. Use ClearSessionLog to discard previously collected text.

More Information and Examples
top
LargeFileMeasures
func (ftp *Ftp2) LargeFileMeasures() bool
func (ftp *Ftp2) SetLargeFileMeasures(b bool)
Introduced in version 9.5.0.66

Controls an additional keepalive measure for very long uploads and downloads. The default is false. When enabled, Chilkat sends NOOP on the FTP control channel once per minute while a long-running file transfer is in progress.

This helps prevent the otherwise idle control connection from being closed by the server, a firewall, or a NAT device while file data continues on the separate data connection.

FTP connection model: File contents travel over a data connection, while FTP commands and replies use the control connection. During a long transfer, the control connection may appear idle even though the data connection remains active.

top
LastErrorHtml
func (ftp *Ftp2) LastErrorHtml() string

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorText
func (ftp *Ftp2) LastErrorText() string

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorXml
func (ftp *Ftp2) LastErrorXml() string

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastMethodSuccess
func (ftp *Ftp2) LastMethodSuccess() bool
func (ftp *Ftp2) SetLastMethodSuccess(b bool)

Indicates the success or failure of the most recent method call: true means success, false means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.

top
LastReply
func (ftp *Ftp2) LastReply() string

Contains the most recent FTP control-channel reply, including its three-digit status code and message. Examples include 250 Directory successfully changed. and 550 Failed to change directory.

The value is updated by successful as well as failed commands. After Disconnect, it normally contains the server's reply to QUIT, such as 221 Goodbye.. Some replies are multiline; use this property together with the method return value and LastErrorText when diagnosing a failure.

top
ListOption
func (ftp *Ftp2) ListOption() string
func (ftp *Ftp2) SetListOption(s string)
Introduced in version 11.4.0

Specifies an option string appended literally to the legacy LIST command, such as -a. For example, setting this property to -a sends LIST -a. Chilkat does not interpret the option locally. It has no effect when AllowMlsd causes MLSD to be used or when PreferNlst causes NLST to be used.

LIST options and output formats are not standardized by FTP. Many UNIX-like servers pass the option to an underlying ls implementation, while other servers may reject or interpret it differently.

top
ListPattern
func (ftp *Ftp2) ListPattern() string
func (ftp *Ftp2) SetListPattern(s string)

Specifies the case-insensitive wildcard pattern applied to the cached listing of the current remote directory. The default is *. It affects methods such as GetDirCount, GetFilename, GetIsDirectory, GetSize, and the listing timestamp methods.

Chilkat retrieves the full directory listing and applies this pattern locally; the pattern is not appended to LIST, NLST, or MLSD. For example, *.txt also matches a name such as UPPER.TXT.

Specify only a name pattern, such as *.txt. To list subdir/*.txt, first call ChangeRemoteDir for subdir, then set this property to *.txt.

Listing cache: Changing this property invalidates the cached directory listing, so the next indexed listing call retrieves a fresh listing from the server.

top
LoginVerified
func (ftp *Ftp2) LoginVerified() bool

Indicates whether FTP authentication succeeded during the most recent login attempt. A TCP connection may be established even when this property is false; for example, rejected credentials leave ConnectVerified true and this property false.

This is a verification result, not a current-socket-state property. It remains true after Disconnect if the preceding session was successfully authenticated.

top
PartialTransfer
func (ftp *Ftp2) PartialTransfer() bool

Indicates whether the most recent download method received some, but not all, of the remote file. It is false when no data was received or when the complete file was received.

This property helps distinguish a mid-transfer failure from a failure that occurred before any file data arrived.

top
Passive
func (ftp *Ftp2) Passive() bool
func (ftp *Ftp2) SetPassive(b bool)

Selects the FTP data-connection mode. The default is true for passive mode. Set to false for active mode.

ModeConnection direction
PassiveThe server listens and the client connects to the server for each data transfer.
ActiveThe client listens and the server connects back to the client.
Typical choice: Passive mode. Passive mode is typically used because it is much friendlier to client-side firewalls and NAT (Network Address Translation). In active mode, the server attempts to initiate a data connection back to the client, which many client-side firewalls block. In passive mode, the client initiates both the control and data connections to the server.

top
PassiveUseHostAddr
func (ftp *Ftp2) PassiveUseHostAddr() bool
func (ftp *Ftp2) SetPassiveUseHostAddr(b bool)

Controls how the address returned by PASV is handled. The default is true. When enabled, Chilkat ignores the IP address embedded in the server's PASV reply and connects to the control connection's server address using only the returned port.

This avoids private or otherwise unreachable addresses returned by FTP servers behind NAT, especially when TLS prevents a network device from rewriting the reply.

top
Password
func (ftp *Ftp2) Password() string
func (ftp *Ftp2) SetPassword(s string)

Specifies the password used for FTP authentication. For anonymous FTP, this is commonly an email address or arbitrary identifying string. Applications that already store the password in a SecureString should use SetSecurePassword instead.

top
Port
func (ftp *Ftp2) Port() int
func (ftp *Ftp2) SetPort(v int)

Specifies the FTP server port. Port 21 is conventionally used for plain FTP or explicit FTPS, and port 990 is conventionally used for implicit FTPS.

When AutoFix is true, only these two port numbers cause automatic changes to Ssl, AuthSsl, and AuthTls. A custom port leaves all three TLS-mode properties unchanged.

top
PreferIpv6
func (ftp *Ftp2) PreferIpv6() bool
func (ftp *Ftp2) SetPreferIpv6(b bool)

Controls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses. The default is false, which prefers IPv4. Set it to true to prefer IPv6.

top
PreferNlst
func (ftp *Ftp2) PreferNlst() bool
func (ftp *Ftp2) SetPreferNlst(b bool)

Controls whether NLST is preferred over LIST when a legacy directory listing is required. The default is false. This property is consulted only when AllowMlsd does not result in MLSD being used.

NLST generally returns names only. Do not rely on indexed sizes, timestamps, ownership, group, or permission information after an NLST listing. Because NLST does not reliably identify entry types, Chilkat may send additional commands, such as directory-change tests, to determine which names are directories.

When to use: Enable this only for a server whose LIST output truncates or corrupts names. Keep AllowMlsd enabled whenever possible because MLSD is the standardized machine-readable listing command.

top
ProgressMonSize
func (ftp *Ftp2) ProgressMonSize() int
func (ftp *Ftp2) SetProgressMonSize(v int)

Specifies the expected size, in bytes, of the next file downloaded by GetFile when the size is not otherwise known. Chilkat uses the value to calculate percentage progress.

This is a one-shot setting. It is consumed by the next applicable download and automatically reset to 0. Set it immediately before the download. When a nonzero value is supplied, Chilkat does not need the additional size query controlled by AutoGetSizeForProgress.

If this property is zero, percentage progress may still be available when the server's preliminary transfer reply includes the file size.

top
ProgressMonSize64
func (ftp *Ftp2) ProgressMonSize64() int64
func (ftp *Ftp2) SetProgressMonSize64(v int64)

The 64-bit form of ProgressMonSize. Specifies the expected size, in bytes, of the next download when the value may exceed the 32-bit integer range. It is consumed by the next applicable download and automatically reset to 0.

top
ProxyHostname
func (ftp *Ftp2) ProxyHostname() string
func (ftp *Ftp2) SetProxyHostname(s string)

Specifies the hostname or IP address of a traditional FTP application proxy or firewall. This is distinct from an HTTP CONNECT proxy and from a SOCKS proxy. The login sequence is selected by ProxyMethod.

top
ProxyMethod
func (ftp *Ftp2) ProxyMethod() int
func (ftp *Ftp2) SetProxyMethod(v int)

Selects the login sequence required by a traditional FTP proxy or firewall. The default is 0, meaning no FTP proxy. Configure ProxyHostname, ProxyPort, and the required proxy credentials before connecting.

ValueSequence sent
1 — SITE
USER ProxyUsername
PASS ProxyPassword
SITE Hostname
USER Username
PASS Password
2 — USER user@site
USER Username@Hostname:Port
PASS Password
3 — USER with proxy login
USER ProxyUsername
PASS ProxyPassword
USER Username@Hostname:Port
PASS Password
4 — USER/PASS/ACCT
USER Username@Hostname:Port ProxyUsername
PASS Password
ACCT ProxyPassword
5 — OPEN
USER ProxyUsername
PASS ProxyPassword
OPEN Hostname
USER Username
PASS Password
6 — firewall ID
USER ProxyUsername@Hostname
USER Username
PASS Password
7
USER ProxyUsername
USER ProxyPassword
SITE Hostname:Port
USER Username
PASS Password
8
USER Username@ProxyUsername@Hostname
PASS Password@ProxyPassword
9
ProxyUsername
ProxyPassword
Username
Password
Server-specific feature: These sequences describe historical FTP firewall conventions, not one standardized proxy protocol. Use the value required by the proxy administrator.

top
ProxyPassword
func (ftp *Ftp2) ProxyPassword() string
func (ftp *Ftp2) SetProxyPassword(s string)

Specifies the password used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends on ProxyMethod.

top
ProxyPort
func (ftp *Ftp2) ProxyPort() int
func (ftp *Ftp2) SetProxyPort(v int)

Specifies the TCP port on which the traditional FTP proxy or firewall accepts connections.

top
ProxyUsername
func (ftp *Ftp2) ProxyUsername() string
func (ftp *Ftp2) SetProxyUsername(s string)

Specifies the username used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends on ProxyMethod.

top
ReadTimeout
func (ftp *Ftp2) ReadTimeout() int
func (ftp *Ftp2) SetReadTimeout(v int)

Specifies the maximum number of seconds that a data connection may remain without receiving another byte. The default is 60. A value of 0 or any negative value waits indefinitely.

This is an inactivity timeout, not a limit on total transfer duration. Receiving any data, even a single byte, resets the timer and begins a new full timeout interval. A large download may therefore continue indefinitely as long as data keeps arriving within the configured interval.

top
RequireSslCertVerify
func (ftp *Ftp2) RequireSslCertVerify() bool
func (ftp *Ftp2) SetRequireSslCertVerify(b bool)

Controls verification of the FTP server's TLS certificate chain.

ValueBehavior
false (default)A connection is not rejected solely because normal certificate-chain verification fails.
trueThe connection fails when the certificate is expired, is not yet valid, its signature is invalid, or its chain cannot be verified to a trusted root.

Certificate-chain verification is separate from hostname matching and public-key pinning. Hostname matching, when required, is enforced independently even when this property is false. TlsPinSet supplements rather than replaces normal certificate verification.

The hostname used for the TLS connection is also used for Server Name Indication (SNI) and certificate hostname comparison.

top
RestartNext
func (ftp *Ftp2) RestartNext() bool
func (ftp *Ftp2) SetRestartNext(b bool)

Set to true to request that the next applicable upload or download resume from existing content instead of starting over. Unrelated FTP commands do not consume the setting. The next applicable transfer consumes it and automatically resets it to false.

For a resumed upload, Chilkat obtains the existing remote size, begins reading the local file at that offset, and appends the remaining bytes. For a resumed download to a local file, Chilkat uses the existing local size as the REST offset before retrieving the remaining remote bytes.

Resume requires compatible server support and a correct partial local or remote file. The application should verify that the existing content belongs to the same file version before resuming.

top
SessionLog
func (ftp *Ftp2) SessionLog() string

Contains the in-memory FTP session log collected while KeepSessionLog is true. The log includes protocol commands and server replies and is useful for troubleshooting. Passwords and other sensitive information may appear; handle the text accordingly.

More Information and Examples
top
SocksHostname
func (ftp *Ftp2) SocksHostname() string
func (ftp *Ftp2) SetSocksHostname(s string)

Specifies the hostname or IP address of the SOCKS proxy. It is used only when SocksVersion is 4 or 5.

More Information and Examples
top
SocksPassword
func (ftp *Ftp2) SocksPassword() string
func (ftp *Ftp2) SetSocksPassword(s string)

Specifies the password for SOCKS5 username/password authentication. It is ignored for SOCKS4, which has no password-authentication field.

top
SocksPort
func (ftp *Ftp2) SocksPort() int
func (ftp *Ftp2) SetSocksPort(v int)

Specifies the SOCKS proxy port. The default is 1080. It is used only when SocksVersion is 4 or 5.

top
SocksUsername
func (ftp *Ftp2) SocksUsername() string
func (ftp *Ftp2) SetSocksUsername(s string)

Specifies the SOCKS user identifier. SOCKS5 may use it with password authentication; SOCKS4 sends it as the protocol user ID. It is used only when SocksVersion is 4 or 5.

top
SocksVersion
func (ftp *Ftp2) SocksVersion() int
func (ftp *Ftp2) SetSocksVersion(v int)

Selects SOCKS proxy usage.

ValueBehavior
0Default. Connect directly without a SOCKS proxy.
4Connect through a SOCKS4 proxy.
5Connect through a SOCKS5 proxy.

top
SoRcvBuf
func (ftp *Ftp2) SoRcvBuf() int
func (ftp *Ftp2) SetSoRcvBuf(v int)

Specifies the socket receive-buffer size. The default is 4194304 bytes. Normally this property should remain unchanged.

When download throughput is unexpectedly low, testing a larger value may help. Values should generally be multiples of 4096.

top
SoSndBuf
func (ftp *Ftp2) SoSndBuf() int
func (ftp *Ftp2) SetSoSndBuf(v int)

Specifies the socket send-buffer size. The default is 262144 bytes. Normally this property should remain unchanged.

When upload throughput is unexpectedly low, testing values such as 524288 or 1048576 may help. Values should generally be multiples of 4096.

top
Ssl
func (ftp *Ftp2) Ssl() bool
func (ftp *Ftp2) SetSsl(b bool)

Set to true to use implicit FTP over TLS. TLS begins immediately after the TCP connection is established, before the FTP greeting is received. Port 990 is conventionally used for implicit FTPS.

This property has priority over AuthTls and AuthSsl. If Ssl is true, implicit TLS is used even when either explicit-TLS property is also true. ConnectOnly performs the implicit TLS handshake but does not send USER or PASS.

TLS-mode precedence: Ssl has highest priority. When it is false, AuthTls takes priority over AuthSsl. When all three properties are false, plain FTP is used.
Protocol distinction: FTPS is FTP protected by TLS. SFTP is a different protocol carried by SSH and is implemented by the SFtp class.

More Information and Examples
top
SslAllowedCiphers
func (ftp *Ftp2) SslAllowedCiphers() string
func (ftp *Ftp2) SetSslAllowedCiphers(s string)
Introduced in version 9.5.0.48

Restricts the cipher suites and selected TLS security requirements offered for FTP TLS connections.

Leave this property empty to allow all cipher suites implemented by the installed Chilkat version. To restrict negotiation, provide a comma-separated list in preference order, for example:

TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

The server chooses from the cipher suites offered by the client; the client cannot force a suite the server does not support.

The list may also contain these policy keywords:

  • rsa1024 or rsa2048 to require a minimum RSA server-key size.
  • secure-renegotiation to require secure TLS renegotiation.
  • best-practices to use the security policy recommended by the installed Chilkat version.

Legacy keywords such as aes256-cbc, aes128-cbc, 3des-cbc, and rc4 remain recognized for compatibility, but explicitly listing acceptable suites is preferred.

top
SslProtocol
func (ftp *Ftp2) SslProtocol() string
func (ftp *Ftp2) SetSslProtocol(s string)

Selects the TLS protocol version or minimum version allowed for secure FTP connections.

The complete list of accepted values is:

default
TLS 1.3
TLS 1.2
TLS 1.1
TLS 1.0
SSL 3.0
TLS 1.3 or higher
TLS 1.2 or higher
TLS 1.1 or higher
TLS 1.0 or higher

The default is default, which allows Chilkat to negotiate a protocol supported by both client and server. A minimum-version setting is generally more interoperable than requiring one exact version.

top
SslServerCertVerified
func (ftp *Ftp2) SslServerCertVerified() bool

Indicates whether the FTP server certificate chain was successfully verified for the current or most recent TLS connection.

This property reports certificate-chain verification only. It does not report hostname matching or public-key pinning. If hostname matching or TlsPinSet pinning is required and the check fails, the TLS connection itself fails.

top
SyncCreateAllLocalDirs
func (ftp *Ftp2) SyncCreateAllLocalDirs() bool
func (ftp *Ftp2) SetSyncCreateAllLocalDirs(b bool)
Introduced in version 9.5.0.76

Controls whether download synchronization creates empty remote directories on the local filesystem. The default is true. When false, a local directory is created only when it is needed to contain a downloaded file.

top
SyncMustMatch
func (ftp *Ftp2) SyncMustMatch() string
func (ftp *Ftp2) SetSyncMustMatch(s string)

Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that are eligible for synchronization and tree operations. For example: *.xml;*.txt;*.csv.

When nonempty, a file must match at least one pattern. This filter applies to synchronization methods and also to DownloadTree and DirTreeXml.

top
SyncMustMatchDir
func (ftp *Ftp2) SyncMustMatchDir() string
func (ftp *Ftp2) SetSyncMustMatchDir(s string)
Introduced in version 9.5.0.76

Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods are allowed to enter. For example: src;data_*;reports. When nonempty, a directory must match at least one pattern before its contents are traversed.

top
SyncMustNotMatch
func (ftp *Ftp2) SyncMustNotMatch() string
func (ftp *Ftp2) SetSyncMustNotMatch(s string)

Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that must be excluded from synchronization and tree operations. For example: *.tmp;*.bak;~*.

Exclusion is applied in addition to SyncMustMatch. This filter also applies to DownloadTree and DirTreeXml.

top
SyncMustNotMatchDir
func (ftp *Ftp2) SyncMustNotMatchDir() string
func (ftp *Ftp2) SetSyncMustNotMatchDir(s string)
Introduced in version 9.5.0.76

Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods must not enter. For example: .git;temp;archive_*. Exclusion is applied in addition to SyncMustMatchDir.

top
SyncPreview
func (ftp *Ftp2) SyncPreview() string

Contains the preview produced by SyncRemoteTree2 when ARG4 is true. Each CRLF-delimited line is an absolute local path that would be uploaded if preview mode were disabled.

The value is replaced by each preview operation and is cleared by a subsequent non-preview synchronization operation.

top
TlsCipherSuite
func (ftp *Ftp2) TlsCipherSuite() string
Introduced in version 9.5.0.49

Contains the cipher suite negotiated for the current or most recent successful TLS connection, such as TLS_AES_256_GCM_SHA384. It is empty before a TLS session has been established or after a failed attempt that produced no negotiated suite.

top
TlsPinSet
func (ftp *Ftp2) TlsPinSet() string
func (ftp *Ftp2) SetTlsPinSet(s string)
Introduced in version 9.5.0.55

Specifies one or more expected Subject Public Key Info (SPKI) fingerprints for TLS public-key pinning. If none of the configured pins matches the server certificate, the TLS handshake fails.

Pinning supplements normal certificate-chain verification; it does not replace it. A matching pin does not make an expired or otherwise invalid certificate acceptable. When a pin set is configured, pin matching is enforced even if RequireSslCertVerify is false.

The format is:

hashAlgorithm, encoding, fingerprint1, fingerprint2, ...

Example:

sha256, base64, lKg1SIqyhPSK19tlPbjl8s02yChsVTDklQpkMCHvsTE=

Supported hash algorithms include sha1, sha256, sha384, sha512, md2, md5, haval, ripemd128, ripemd160, ripemd256, and ripemd320. Supported encodings include base64, hex, and other Chilkat-supported binary encodings.

FTP connection scope: Pin matching is enforced for every TLS connection established by this object, including the FTPS control connection and all TLS-protected data connections.

More Information and Examples
top
TlsVersion
func (ftp *Ftp2) TlsVersion() string
Introduced in version 9.5.0.49

Contains the protocol version negotiated for the current or most recent successful TLS connection, such as TLS 1.2 or TLS 1.3. It is empty when no TLS session has been established.

top
UncommonOptions
func (ftp *Ftp2) UncommonOptions() string
func (ftp *Ftp2) SetUncommonOptions(s string)
Introduced in version 9.5.0.78

Provides a comma-separated list of compatibility options for uncommon platform or server requirements. The default is empty and should normally remain empty.

KeywordEffect
OpenNonExclusiveOn Windows, opens a local download file without exclusive sharing so another process may access it while data is being written.
ProtectFromVpnOn Android, requests that FTP sockets bypass an active VPN.
EnableTls13Compatibility switch that explicitly enables offering TLS 1.3 in builds where it is not already enabled by policy.
DisableTls13Prevents TLS 1.3 negotiation for compatibility with a problematic peer.
NoPreserveFileTimeLeaves downloaded files with the current local time instead of attempting to preserve the remote modification time.
Use sparingly: These options alter low-level behavior and may be platform-specific. Configure one only when the documented default causes a known interoperability problem.

More Information and Examples
top
UploadTransferRate
func (ftp *Ftp2) UploadTransferRate() int

Returns the current average upload rate in bytes per second. The value is updated during synchronous and asynchronous uploads and describes the upload in progress or the most recently completed upload. A subsequent download does not clear the retained upload rate.

top
UseEpsv
func (ftp *Ftp2) UseEpsv() bool
func (ftp *Ftp2) SetUseEpsv(b bool)

Controls whether passive data connections first use EPSV instead of PASV. The default is false. This property has no effect when Passive is false.

If EPSV is rejected, Chilkat automatically retries the data connection using PASV. The rejection does not disable EPSV for the remainder of the session, so a later passive data connection may try EPSV again.

AutoSetUseEpsv can change this property automatically when server capabilities are examined.

Compatibility: EPSV avoids embedding an IP address in the server reply and is the passive-mode command defined for IPv6. Some legacy FTP-aware firewalls mishandle it.

top
Username
func (ftp *Ftp2) Username() string
func (ftp *Ftp2) SetUsername(s string)

Specifies the FTP login name. The default is anonymous. Set it to an empty string to have Connect establish the connection without performing authentication; authentication may then be handled separately with LoginAfterConnectOnly.

top
VerboseLogging
func (ftp *Ftp2) VerboseLogging() bool
func (ftp *Ftp2) SetVerboseLogging(b bool)

If set to true, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is false. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
func (ftp *Ftp2) Version() string

Version of the component/library, such as "10.1.0"

More Information and Examples
top

Methods

AppendFile
func (ftp *Ftp2) AppendFile(localFilePath string, remoteFilePath string) bool

Appends the contents of the local file at localFilePath to the remote file at remoteFilePath. If the remote file does not exist, server behavior may be equivalent to creating it. Both arguments are paths in their respective local and remote filesystems.

Returns true for success, false for failure.

top
AppendFileAsync (1)
func (ftp *Ftp2) AppendFileAsync(localFilePath string, remoteFilePath string, task chan *Task)

Creates an asynchronous task to call the AppendFile method with the arguments provided.

Returns nil on failure

top
AppendFileBd
func (ftp *Ftp2) AppendFileBd(remoteFilename string, bd *BinData) bool
Introduced in version 11.0.0

Appends the bytes in the BinData object bd to the remote file at remoteFilename. No text encoding or line-ending conversion is performed.

Returns true for success, false for failure.

top
AppendFileBdAsync (1)
func (ftp *Ftp2) AppendFileBdAsync(remoteFilename string, bd *BinData, task chan *Task)
Introduced in version 11.0.0

Creates an asynchronous task to call the AppendFileBd method with the arguments provided.

Returns nil on failure

top
AppendFileFromBinaryData
func (ftp *Ftp2) AppendFileFromBinaryData(remoteFilename string, content []byte) bool

Appends the bytes in content to the remote file named by remoteFilename. No character encoding or line-ending conversion is performed.

Returns true for success, false for failure.

top
AppendFileFromBinaryDataAsync (1)
func (ftp *Ftp2) AppendFileFromBinaryDataAsync(remoteFilename string, content []byte, task chan *Task)

Creates an asynchronous task to call the AppendFileFromBinaryData method with the arguments provided.

Returns nil on failure

top
AppendFileFromTextData
func (ftp *Ftp2) AppendFileFromTextData(remoteFilename string, textData string, charset string) bool

Encodes the text in textData using the character encoding named by charset and appends the resulting bytes to the remote file at remoteFilename.

This method controls the encoding of the file content. The encoding used for the remote filename itself is controlled separately by CommandCharset.

Returns true for success, false for failure.

top
AppendFileFromTextDataAsync (1)
func (ftp *Ftp2) AppendFileFromTextDataAsync(remoteFilename string, textData string, charset string, task chan *Task)

Creates an asynchronous task to call the AppendFileFromTextData method with the arguments provided.

Returns nil on failure

top
AppendFileSb
func (ftp *Ftp2) AppendFileSb(remoteFilename string, sb *StringBuilder, charset string) bool
Introduced in version 11.0.0

Encodes the text in the StringBuilder sb using the charset named by charset and appends the resulting bytes to the remote file at remoteFilename.

Returns true for success, false for failure.

top
AppendFileSbAsync (1)
func (ftp *Ftp2) AppendFileSbAsync(remoteFilename string, sb *StringBuilder, charset string, task chan *Task)
Introduced in version 11.0.0

Creates an asynchronous task to call the AppendFileSb method with the arguments provided.

Returns nil on failure

top
ChangeRemoteDir
func (ftp *Ftp2) ChangeRemoteDir(remoteDirPath string) bool

Changes the current working directory on the FTP server to remoteDirPath. A relative path is resolved from the current remote directory; an absolute path is interpreted according to the server's path syntax.

Some servers accept a multi-level path in one CWD command, while others require one directory level at a time.

Current directory: Many Ftp2 methods operate relative to the current remote directory. Use GetCurrentRemoteDir to inspect it.

Returns true for success, false for failure.

top
ChangeRemoteDirAsync (1)
func (ftp *Ftp2) ChangeRemoteDirAsync(remoteDirPath string, task chan *Task)

Creates an asynchronous task to call the ChangeRemoteDir method with the arguments provided.

Returns nil on failure

top
CheckConnection
func (ftp *Ftp2) CheckConnection() bool
Introduced in version 9.5.0.44

Tests whether the FTP control session is still connected and authenticated. The method may send NOOP so the result reflects the server's response rather than only the local socket state.

Returns true for success, false for failure.

top
CheckConnectionAsync (1)
func (ftp *Ftp2) CheckConnectionAsync(task chan *Task)
Introduced in version 9.5.0.44

Creates an asynchronous task to call the CheckConnection method with the arguments provided.

Returns nil on failure

top
ClearControlChannel
func (ftp *Ftp2) ClearControlChannel() bool

Requests that an explicit-FTPS control connection return to clear text after authentication. Data connections may remain protected according to DataProtection.

Security and compatibility: This is a legacy workaround for FTP-aware NAT devices that must inspect PORT or PASV commands. It exposes FTP commands and replies, including path names, and should not be used unless required by the network environment.

Returns true for success, false for failure.

top
ClearControlChannelAsync (1)
func (ftp *Ftp2) ClearControlChannelAsync(task chan *Task)

Creates an asynchronous task to call the ClearControlChannel method with the arguments provided.

Returns nil on failure

top
ClearDirCache
func (ftp *Ftp2) ClearDirCache()

Clears the cached listing for the current remote directory. The next call to GetDirCount or another indexed listing method retrieves a fresh listing from the server. The cache is also invalidated when the current directory or ListPattern changes.

top
ClearSessionLog
func (ftp *Ftp2) ClearSessionLog()

Clears the in-memory FTP protocol log collected while KeepSessionLog is enabled.

top
Connect
func (ftp *Ftp2) Connect() bool

Connects to the server specified by Hostname and Port, negotiates any configured proxy and TLS layer, receives the FTP greeting, and authenticates using Username, Password, and Account.

For implicit or explicit FTPS, TLS is established before USER and PASS are sent. During connection setup, Chilkat sends PBSZ and PROT as required by DataProtection. If the server replies with 530 Please login with USER and PASS, Chilkat authenticates and automatically retries those commands. Rejection of a required PBSZ or PROT command causes the connection attempt to fail.

A failed connection attempt does not leave an underlying plain FTP connection open. To separate connection establishment from authentication, call ConnectOnly followed by LoginAfterConnectOnly.

Failure diagnosis: After failure, inspect ConnectFailReason, LastReply, and LastErrorText. A failure before the FTP greeting is usually DNS, routing, firewall, proxy, TCP, or implicit-TLS related; a failure after the greeting may involve explicit TLS, data-protection setup, authentication, or server policy.

Returns true for success, false for failure.

top
ConnectAsync (1)
func (ftp *Ftp2) ConnectAsync(task chan *Task)

Creates an asynchronous task to call the Connect method with the arguments provided.

Returns nil on failure

top
ConnectOnly
func (ftp *Ftp2) ConnectOnly() bool

Establishes the configured proxy and TCP connection, performs any configured implicit or explicit TLS setup, and receives the FTP server greeting, but does not send USER or PASS. Complete authentication by calling LoginAfterConnectOnly.

With implicit FTPS, the TLS handshake occurs immediately after the TCP connection is established and before the greeting is received. With explicit FTPS, Chilkat first receives the greeting, sends AUTH TLS or AUTH SSL, and then performs the TLS handshake.

Returns true for success, false for failure.

top
ConnectOnlyAsync (1)
func (ftp *Ftp2) ConnectOnlyAsync(task chan *Task)

Creates an asynchronous task to call the ConnectOnly method with the arguments provided.

Returns nil on failure

top
ConvertToTls
func (ftp *Ftp2) ConvertToTls() bool

Upgrades an already-connected clear FTP control channel to TLS. This method is intended for a manually staged connection created with ConnectOnly.

Do not call it when AuthTls or AuthSsl was enabled before connecting; those properties perform the upgrade automatically.

Returns true for success, false for failure.

top
ConvertToTlsAsync (1)
func (ftp *Ftp2) ConvertToTlsAsync(task chan *Task)

Creates an asynchronous task to call the ConvertToTls method with the arguments provided.

Returns nil on failure

top
CreatePlan
func (ftp *Ftp2) CreatePlan(localDir string) *string

Creates and returns a textual upload plan for the local directory at localDir. The plan lists the operations that PutTree would perform and can later be executed by PutPlan.

Resumable bulk upload: PutPlan records completed operations in a log file. Reusing the plan and log after interruption allows already completed steps to be skipped.

Returns nil on failure

More Information and Examples
top
CreatePlanAsync (1)
func (ftp *Ftp2) CreatePlanAsync(localDir string, task chan *Task)

Creates an asynchronous task to call the CreatePlan method with the arguments provided.

Returns nil on failure

top
CreateRemoteDir
func (ftp *Ftp2) CreateRemoteDir(remoteDirPath string) bool

Creates the remote directory at remoteDirPath by sending the server's directory-creation command. The path is interpreted relative to the current remote directory unless the server recognizes it as absolute.

If the directory already exists, the server commonly returns an error and the method fails.

Returns true for success, false for failure.

top
CreateRemoteDirAsync (1)
func (ftp *Ftp2) CreateRemoteDirAsync(remoteDirPath string, task chan *Task)

Creates an asynchronous task to call the CreateRemoteDir method with the arguments provided.

Returns nil on failure

top
DeleteMatching
func (ftp *Ftp2) DeleteMatching(remotePattern string) int

Deletes files in the current remote directory whose names match the wildcard pattern in remotePattern. The method returns the number deleted, or -1 if the operation fails.

* matches zero or more characters. Matching details may depend on the server because the remote listing operation is server-side.

top
DeleteMatchingAsync (1)
func (ftp *Ftp2) DeleteMatchingAsync(remotePattern string, task chan *Task)

Creates an asynchronous task to call the DeleteMatching method with the arguments provided.

Returns nil on failure

top
DeleteRemoteFile
func (ftp *Ftp2) DeleteRemoteFile(remoteFilePath string) bool

Deletes the remote file at remoteFilePath. The path may be relative to the current remote directory or absolute according to the server's path syntax.

Returns true for success, false for failure.

top
DeleteRemoteFileAsync (1)
func (ftp *Ftp2) DeleteRemoteFileAsync(remoteFilePath string, task chan *Task)

Creates an asynchronous task to call the DeleteRemoteFile method with the arguments provided.

Returns nil on failure

top
DeleteTree
func (ftp *Ftp2) DeleteTree() bool

Recursively deletes the files and subdirectories beneath the current remote directory and then removes directories as they become empty.

Destructive operation: Set the current remote directory carefully before calling this method. The VerifyDeleteFile and VerifyDeleteDir callbacks can set their skip output to prevent selected items from being deleted.

Returns true for success, false for failure.

More Information and Examples
top
DeleteTreeAsync (1)
func (ftp *Ftp2) DeleteTreeAsync(task chan *Task)

Creates an asynchronous task to call the DeleteTree method with the arguments provided.

Returns nil on failure

top
DirTreeXml
func (ftp *Ftp2) DirTreeXml() *string

Returns an XML representation of the complete remote directory tree rooted at the current remote directory. Traversal is affected by SyncMustMatch, SyncMustNotMatch, SyncMustMatchDir, and SyncMustNotMatchDir.

This method retrieves metadata; it does not download file content.

Returns nil on failure

More Information and Examples
top
DirTreeXmlAsync (1)
func (ftp *Ftp2) DirTreeXmlAsync(task chan *Task)

Creates an asynchronous task to call the DirTreeXml method with the arguments provided.

Returns nil on failure

top
Disconnect
func (ftp *Ftp2) Disconnect() bool

Ends the FTP session and closes the control connection. When possible, Chilkat sends the normal FTP quit command before closing the socket.

Returns true for success, false for failure.

top
DisconnectAsync (1)
func (ftp *Ftp2) DisconnectAsync(task chan *Task)

Creates an asynchronous task to call the Disconnect method with the arguments provided.

Returns nil on failure

top
DownloadTree
func (ftp *Ftp2) DownloadTree(localRoot string) bool

Downloads all selected files and subdirectories beneath the current remote directory and recreates the tree under the local directory at localRoot.

The file and directory filters in SyncMustMatch, SyncMustNotMatch, SyncMustMatchDir, and SyncMustNotMatchDir apply. Use SetOldestDateStr to exclude files older than a chosen date.

Returns true for success, false for failure.

top
DownloadTreeAsync (1)
func (ftp *Ftp2) DownloadTreeAsync(localRoot string, task chan *Task)

Creates an asynchronous task to call the DownloadTree method with the arguments provided.

Returns nil on failure

top
Feat
func (ftp *Ftp2) Feat() *string

Sends FEAT and returns the server's multiline capability reply. A server may return an error when the command is unsupported. Chilkat also performs capability discovery automatically when AutoFeat is enabled.

A successful explicit call performs the same capability processing as automatic FEAT. It can update HasModeZ, listing-extension detection, UTF-8 handling through AutoOptsUtf8, and UseEpsv through AutoSetUseEpsv, even when AutoFeat is false.

Returns nil on failure

More Information and Examples
top
FeatAsync (1)
func (ftp *Ftp2) FeatAsync(task chan *Task)

Creates an asynchronous task to call the Feat method with the arguments provided.

Returns nil on failure

top
GetCreateTimeByNameStr
func (ftp *Ftp2) GetCreateTimeByNameStr(filename string) *string

Returns the creation time for the file or directory named by filename in the current remote directory as an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name so the item is present in the cached listing.

Creation times: Many UNIX-like filesystems and FTP listing formats do not provide a file creation time. In that case the server or parser may report the modification time instead.

Returns nil on failure

top
GetCreateTimeByNameStrAsync (1)
func (ftp *Ftp2) GetCreateTimeByNameStrAsync(filename string, task chan *Task)

Creates an asynchronous task to call the GetCreateTimeByNameStr method with the arguments provided.

Returns nil on failure

top
GetCreateTimeStr
func (ftp *Ftp2) GetCreateTimeStr(index int) *string

Returns the creation time for cached directory-listing entry index as an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600. index is a zero-based index from 0 through one less than GetDirCount. Creation-time availability depends on the server and listing format.

Returns nil on failure

top
GetCreateTimeStrAsync (1)
func (ftp *Ftp2) GetCreateTimeStrAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetCreateTimeStr method with the arguments provided.

Returns nil on failure

top
GetCurrentRemoteDir
func (ftp *Ftp2) GetCurrentRemoteDir() *string

Returns the current working directory reported by the FTP server, normally by using the PWD command.

Returns nil on failure

top
GetCurrentRemoteDirAsync (1)
func (ftp *Ftp2) GetCurrentRemoteDirAsync(task chan *Task)

Creates an asynchronous task to call the GetCurrentRemoteDir method with the arguments provided.

Returns nil on failure

top
GetDirCount
func (ftp *Ftp2) GetDirCount() int
Introduced in version 9.5.0.44

Returns the number of files and directories in the cached listing of the current remote directory after applying the case-insensitive ListPattern. On the first call, Chilkat obtains and caches the full directory listing and then applies the pattern locally. Repeated indexed listing calls use the cache until it is invalidated. Call ClearDirCache to force a refresh. Returns -1 if the listing cannot be obtained or parsed.

Directory listings use a data connection: An FTP listing is transferred over a separate data connection, just like an upload or download. If this method stalls, investigate passive/active mode, NAT, firewall rules, and the data-connection details in LastErrorText.

More Information and Examples
top
GetDirCountAsync (1)
func (ftp *Ftp2) GetDirCountAsync(task chan *Task)
Introduced in version 9.5.0.44

Creates an asynchronous task to call the GetDirCount method with the arguments provided.

Returns nil on failure

top
GetFile
func (ftp *Ftp2) GetFile(remoteFilePath string, localFilePath string) bool

Downloads the remote file at remoteFilePath to the local filesystem path at localFilePath. The local file is created or replaced according to the normal download behavior.

Use RestartNext immediately before this call to request resume of an existing partial file. ReadTimeout controls data-channel inactivity.

Returns true for success, false for failure.

top
GetFileAsync (1)
func (ftp *Ftp2) GetFileAsync(remoteFilePath string, localFilePath string, task chan *Task)

Creates an asynchronous task to call the GetFile method with the arguments provided.

Returns nil on failure

More Information and Examples
top
GetFileBd
func (ftp *Ftp2) GetFileBd(remoteFilePath string, binData *BinData) bool
Introduced in version 9.5.0.62

Downloads the remote file at remoteFilePath and places its bytes in the BinData object in binData. No text decoding or line-ending conversion is performed.

Returns true for success, false for failure.

More Information and Examples
top
GetFileBdAsync (1)
func (ftp *Ftp2) GetFileBdAsync(remoteFilePath string, binData *BinData, task chan *Task)
Introduced in version 9.5.0.62

Creates an asynchronous task to call the GetFileBd method with the arguments provided.

Returns nil on failure

top
GetFilename
func (ftp *Ftp2) GetFilename(index int) *string

Returns the name of cached directory-listing entry index. index is a zero-based index from 0 through one less than GetDirCount. The returned value is the name from the listing, not necessarily a full remote path.

Returns nil on failure

More Information and Examples
top
GetFilenameAsync (1)
func (ftp *Ftp2) GetFilenameAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetFilename method with the arguments provided.

Returns nil on failure

top
GetFileSb
func (ftp *Ftp2) GetFileSb(remoteFilePath string, charset string, sb *StringBuilder) bool
Introduced in version 9.5.0.62

Downloads the remote file at remoteFilePath, decodes its bytes using the charset named by charset, and places the resulting text in the StringBuilder in sb.

Returns true for success, false for failure.

More Information and Examples
top
GetFileSbAsync (1)
func (ftp *Ftp2) GetFileSbAsync(remoteFilePath string, charset string, sb *StringBuilder, task chan *Task)
Introduced in version 9.5.0.62

Creates an asynchronous task to call the GetFileSb method with the arguments provided.

Returns nil on failure

top
GetFileToStream
func (ftp *Ftp2) GetFileToStream(remoteFilePath string, toStream *Stream) bool
Introduced in version 9.5.0.67

Downloads the remote file at remoteFilePath and writes its bytes to the Stream in toStream.

For a synchronous call, toStream must be configured with a destination sink before the method begins. For an asynchronous call, application code may read from the stream while the background download produces data.

Returns true for success, false for failure.

More Information and Examples
top
GetFileToStreamAsync (1)
func (ftp *Ftp2) GetFileToStreamAsync(remoteFilePath string, toStream *Stream, task chan *Task)
Introduced in version 9.5.0.67

Creates an asynchronous task to call the GetFileToStream method with the arguments provided.

Returns nil on failure

top
GetGroup
func (ftp *Ftp2) GetGroup(index int) *string
Introduced in version 9.5.0.50

Returns the group name or identifier for cached directory-listing entry index. The value is empty when the server does not provide group metadata.

MLSD metadata: MLSD commonly provides accurate size and time facts but often omits owner and group. On a UNIX-like server, disabling AllowMlsd may expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.

Returns nil on failure

top
GetGroupAsync (1)
func (ftp *Ftp2) GetGroupAsync(index int, task chan *Task)
Introduced in version 9.5.0.50

Creates an asynchronous task to call the GetGroup method with the arguments provided.

Returns nil on failure

top
GetIsDirectory
func (ftp *Ftp2) GetIsDirectory(index int) bool

Returns true when cached directory-listing entry index is identified as a directory. index is a zero-based index into the current cached listing.

top
GetIsDirectoryAsync (1)
func (ftp *Ftp2) GetIsDirectoryAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetIsDirectory method with the arguments provided.

Returns nil on failure

top
GetIsSymbolicLink
func (ftp *Ftp2) GetIsSymbolicLink(index int) bool

Returns true when cached directory-listing entry index is identified as a symbolic link. This information is available only when the server's listing format reports it.

top
GetIsSymbolicLinkAsync (1)
func (ftp *Ftp2) GetIsSymbolicLinkAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetIsSymbolicLink method with the arguments provided.

Returns nil on failure

top
GetLastJsonData
func (ftp *Ftp2) GetLastJsonData(json *JsonObject)
Introduced in version 11.5.0

Copies JSON details from the most recent method call into the JsonObject in json. Only methods that produce structured supplemental information populate this data; otherwise the object may remain empty. Call this method immediately after the operation whose details are needed.

Returns true for success, false for failure.

top
GetLastModifiedTimeByNameStr
func (ftp *Ftp2) GetLastModifiedTimeByNameStr(filename string) *string

Returns the last-modified time for the item named by filename in the current remote directory as an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name.

Returns nil on failure

top
GetLastModifiedTimeByNameStrAsync (1)
func (ftp *Ftp2) GetLastModifiedTimeByNameStrAsync(filename string, task chan *Task)

Creates an asynchronous task to call the GetLastModifiedTimeByNameStr method with the arguments provided.

Returns nil on failure

top
GetLastModifiedTimeStr
func (ftp *Ftp2) GetLastModifiedTimeStr(index int) *string

Returns the last-modified time for cached directory-listing entry index as an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600. index is a zero-based index into the current cached listing.

Returns nil on failure

top
GetLastModifiedTimeStrAsync (1)
func (ftp *Ftp2) GetLastModifiedTimeStrAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetLastModifiedTimeStr method with the arguments provided.

Returns nil on failure

top
GetOwner
func (ftp *Ftp2) GetOwner(index int) *string
Introduced in version 9.5.0.50

Returns the owner name or identifier for cached directory-listing entry index. The value is empty when the server does not provide owner metadata.

MLSD metadata: MLSD commonly provides accurate size and time facts but often omits owner and group. On a UNIX-like server, disabling AllowMlsd may expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.

Returns nil on failure

top
GetOwnerAsync (1)
func (ftp *Ftp2) GetOwnerAsync(index int, task chan *Task)
Introduced in version 9.5.0.50

Creates an asynchronous task to call the GetOwner method with the arguments provided.

Returns nil on failure

top
GetPermissions
func (ftp *Ftp2) GetPermissions(index int) *string
Introduced in version 9.5.0.50

Returns the permissions or status string for cached directory-listing entry index. The value is empty when the server provides no such metadata. Use GetPermType to determine how to interpret the result.

Permission typeReturned information
mlsdThe RFC 3659 perm fact. Letters describe FTP operations available to the logged-in user, such as append, create, delete, enter, list, rename, or write.
unixA UNIX-style string such as rwxr-xr-x.
netwareNetWare trustee-right letters such as read, write, create, erase, modify, file scan, access control, and supervisor.
openvmsAn OpenVMS protection string such as (RWED,RWED,R,R).
batchStatusFlagsA fixed-position Connect:Enterprise batch-status string such as -CR--M----.
MLSD perm is not a file mode: The MLSD perm fact describes operations the current FTP account may perform. It is not equivalent to UNIX owner/group/other permission bits.

Returns nil on failure

More Information and Examples
top
GetPermissionsAsync (1)
func (ftp *Ftp2) GetPermissionsAsync(index int, task chan *Task)
Introduced in version 9.5.0.50

Creates an asynchronous task to call the GetPermissions method with the arguments provided.

Returns nil on failure

top
GetPermType
func (ftp *Ftp2) GetPermType(index int) *string
Introduced in version 9.5.0.50

Returns the format identifier for the permissions string available for cached listing entry index. The value is empty when no permissions are available.

ValueFormat
mlsdThe RFC 3659 perm fact.
unixA UNIX/POSIX-style mode string.
netwareNetWare trustee rights.
openvmsAn OpenVMS protection string.
batchStatusFlagsConnect:Enterprise batch status flags.

Use GetPermissions to obtain the corresponding value.

Returns nil on failure

More Information and Examples
top
GetPermTypeAsync (1)
func (ftp *Ftp2) GetPermTypeAsync(index int, task chan *Task)
Introduced in version 9.5.0.50

Creates an asynchronous task to call the GetPermType method with the arguments provided.

Returns nil on failure

top
GetRemoteFileBinaryData
func (ftp *Ftp2) GetRemoteFileBinaryData(remoteFilename string) []byte

Downloads the remote file at remoteFilename and returns its bytes. No character decoding or line-ending conversion is performed.

Returns nil on failure

More Information and Examples
top
GetRemoteFileBinaryDataAsync (1)
func (ftp *Ftp2) GetRemoteFileBinaryDataAsync(remoteFilename string, task chan *Task)

Creates an asynchronous task to call the GetRemoteFileBinaryData method with the arguments provided.

Returns nil on failure

top
GetRemoteFileTextC
func (ftp *Ftp2) GetRemoteFileTextC(remoteFilename string, charset string) *string

Downloads the remote file at remoteFilename, decodes its bytes using the character encoding named by charset, and returns the resulting text.

Returns nil on failure

More Information and Examples
top
GetRemoteFileTextCAsync (1)
func (ftp *Ftp2) GetRemoteFileTextCAsync(remoteFilename string, charset string, task chan *Task)

Creates an asynchronous task to call the GetRemoteFileTextC method with the arguments provided.

Returns nil on failure

top
GetRemoteFileTextData
func (ftp *Ftp2) GetRemoteFileTextData(remoteFilename string) *string

Downloads the remote file at remoteFilename and returns its contents decoded using the ANSI character encoding. Use GetRemoteFileTextC when the file uses UTF-8 or another explicitly known encoding.

Returns nil on failure

top
GetRemoteFileTextDataAsync (1)
func (ftp *Ftp2) GetRemoteFileTextDataAsync(remoteFilename string, task chan *Task)

Creates an asynchronous task to call the GetRemoteFileTextData method with the arguments provided.

Returns nil on failure

top
GetServerCert
func (ftp *Ftp2) GetServerCert(cert *Cert) bool
Introduced in version 11.0.0

Loads into the Cert object in cert the certificate presented by the FTP server during the current or most recent TLS connection.

Returns true for success, false for failure.

top
GetSize
func (ftp *Ftp2) GetSize(index int) int

Returns the size in bytes of cached directory-listing entry index as a 32-bit integer. Use GetSize64 for large files. A negative value indicates that the size is unavailable or the operation failed.

top
GetSizeAsync (1)
func (ftp *Ftp2) GetSizeAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetSize method with the arguments provided.

Returns nil on failure

top
GetSize64
func (ftp *Ftp2) GetSize64(index int) int64

Returns the size in bytes of cached directory-listing entry index as a 64-bit integer. Returns -1 when the size is unavailable or the operation fails.

top
GetSize64Async (1)
func (ftp *Ftp2) GetSize64Async(index int, task chan *Task)

Creates an asynchronous task to call the GetSize64 method with the arguments provided.

Returns nil on failure

top
GetSizeByName
func (ftp *Ftp2) GetSizeByName(filename string) int

Returns the size in bytes of the file named by filename in the current remote directory as a 32-bit integer. Returns -1 when the file is not found or the size cannot be obtained. Use GetSizeByName64 for large files.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name.

top
GetSizeByNameAsync (1)
func (ftp *Ftp2) GetSizeByNameAsync(filename string, task chan *Task)

Creates an asynchronous task to call the GetSizeByName method with the arguments provided.

Returns nil on failure

top
GetSizeByName64
func (ftp *Ftp2) GetSizeByName64(filename string) int64

Returns the size in bytes of the file named by filename in the current remote directory as a 64-bit integer. Returns -1 when the file is not found or the size cannot be obtained.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name.

top
GetSizeByName64Async (1)
func (ftp *Ftp2) GetSizeByName64Async(filename string, task chan *Task)

Creates an asynchronous task to call the GetSizeByName64 method with the arguments provided.

Returns nil on failure

top
GetSizeStr
func (ftp *Ftp2) GetSizeStr(index int) *string

Returns the size in bytes of cached directory-listing entry index as a decimal string. This form avoids integer-size limits in languages without a convenient 64-bit type.

Returns nil on failure

top
GetSizeStrAsync (1)
func (ftp *Ftp2) GetSizeStrAsync(index int, task chan *Task)

Creates an asynchronous task to call the GetSizeStr method with the arguments provided.

Returns nil on failure

top
GetSizeStrByName
func (ftp *Ftp2) GetSizeStrByName(filename string) *string

Returns the size in bytes of the file named by filename in the current remote directory as a decimal string. This form avoids language-specific integer limits.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name.

Returns nil on failure

top
GetSizeStrByNameAsync (1)
func (ftp *Ftp2) GetSizeStrByNameAsync(filename string, task chan *Task)

Creates an asynchronous task to call the GetSizeStrByName method with the arguments provided.

Returns nil on failure

top
GetSyncedFiles
func (ftp *Ftp2) GetSyncedFiles(strTable *StringTable)
Introduced in version 10.0.0

Appends to the StringTable in strTable the relative paths affected by the most recent synchronization operation. Existing entries in strTable are preserved. The appended paths include files uploaded, downloaded, or deleted by SyncDeleteRemote, SyncLocalDir, SyncLocalTree, SyncRemoteTree, or SyncRemoteTree2.

top
GetTextDirListing
func (ftp *Ftp2) GetTextDirListing(pattern string) *string

Sends a directory-listing request for pattern and returns the server's raw textual listing. pattern may be a wildcard pattern or other argument accepted by the server.

The format of LIST output is server-specific; use the indexed listing methods or GetXmlDirListing when parsed metadata is preferred.

Returns nil on failure

More Information and Examples
top
GetTextDirListingAsync (1)
func (ftp *Ftp2) GetTextDirListingAsync(pattern string, task chan *Task)

Creates an asynchronous task to call the GetTextDirListing method with the arguments provided.

Returns nil on failure

top
GetXmlDirListing
func (ftp *Ftp2) GetXmlDirListing(pattern string) *string

Retrieves a directory listing for pattern and returns the parsed entries as XML. pattern may be a wildcard pattern accepted by the server. The metadata available depends on whether the server provides MLSD facts or a parseable legacy listing.

Timestamp interpretation: Returned last-modified values are expressed in the client's local time. Legacy FTP listings may omit timezone information, so exact conversion can be impossible when the server timezone is unknown.

Returns nil on failure

top
GetXmlDirListingAsync (1)
func (ftp *Ftp2) GetXmlDirListingAsync(pattern string, task chan *Task)

Creates an asynchronous task to call the GetXmlDirListing method with the arguments provided.

Returns nil on failure

top
LargeFileUpload
func (ftp *Ftp2) LargeFileUpload(localPath string, remotePath string, chunkSize int) bool
Introduced in version 9.5.0.58

Uploads the local file at localPath to the remote path at remotePath as a sequence of append operations, each containing up to chunkSize bytes.

This method addresses a specific FTP failure mode: during one very long data transfer, the control connection is idle and may be silently dropped by a firewall, NAT device, or server timeout. Completing the upload as multiple shorter transfers periodically uses the control channel.

chunkSize is the in-memory chunk size. Larger chunks reduce FTP command overhead but consume more memory and leave the control channel idle longer; smaller chunks have the opposite tradeoff.

Alternative: For ordinary large files, first consider enabling LargeFileMeasures. Use chunked upload when infrastructure still drops the idle control session.

Returns true for success, false for failure.

More Information and Examples
top
LargeFileUploadAsync (1)
func (ftp *Ftp2) LargeFileUploadAsync(localPath string, remotePath string, chunkSize int, task chan *Task)
Introduced in version 9.5.0.58

Creates an asynchronous task to call the LargeFileUpload method with the arguments provided.

Returns nil on failure

top
LoadTaskCaller
func (ftp *Ftp2) LoadTaskCaller(task *Task) bool
Introduced in version 9.5.0.80

Loads the original caller object associated with the asynchronous Task in task. This is an internal support method for Chilkat's task infrastructure and is not normally needed by application code.

Returns true for success, false for failure.

top
LoginAfterConnectOnly
func (ftp *Ftp2) LoginAfterConnectOnly() bool

Authenticates an FTP session previously established by ConnectOnly, using Username, Password, and Account. When TLS is configured, the secure connection has already been established before this method sends USER and PASS.

Together, ConnectOnly and this method perform the connection and login stages of Connect. After authentication, Chilkat performs the configured automatic capability and system queries. Set AutoFeat or AutoSyst to false to suppress those commands.

Returns true for success, false for failure.

top
LoginAfterConnectOnlyAsync (1)
func (ftp *Ftp2) LoginAfterConnectOnlyAsync(task chan *Task)

Creates an asynchronous task to call the LoginAfterConnectOnly method with the arguments provided.

Returns nil on failure

top
MGetFiles
func (ftp *Ftp2) MGetFiles(remotePattern string, localDir string) int

Downloads files in the current remote directory that match remotePattern into the local directory at localDir. Subdirectories are not traversed. The method returns the number of files downloaded, or -1 on failure.

Wildcard matching is performed by the FTP server's listing command and may be case-sensitive or case-insensitive according to the remote server and filesystem.

More Information and Examples
top
MGetFilesAsync (1)
func (ftp *Ftp2) MGetFilesAsync(remotePattern string, localDir string, task chan *Task)

Creates an asynchronous task to call the MGetFiles method with the arguments provided.

Returns nil on failure

top
MPutFiles
func (ftp *Ftp2) MPutFiles(pattern string) int

Uploads each local file matching pattern to the current remote directory. pattern may include a local directory and wildcard, such as C:/data/*.txt. Subdirectories are not traversed.

The method returns the number of files uploaded, or -1 on failure.

top
MPutFilesAsync (1)
func (ftp *Ftp2) MPutFilesAsync(pattern string, task chan *Task)

Creates an asynchronous task to call the MPutFiles method with the arguments provided.

Returns nil on failure

top
NlstXml
func (ftp *Ftp2) NlstXml(remoteDirPattern string) *string

Sends NLST with remoteDirPattern and returns the names in XML form. remoteDirPattern may be a pattern such as *, *.txt, or subdir/*.xml.

<nlst>
  <e>name1</e>
  <e>name2</e>
</nlst>

NLST normally returns names only; it does not provide reliable sizes, times, or permissions.

Returns nil on failure

top
NlstXmlAsync (1)
func (ftp *Ftp2) NlstXmlAsync(remoteDirPattern string, task chan *Task)

Creates an asynchronous task to call the NlstXml method with the arguments provided.

Returns nil on failure

top
Noop
func (ftp *Ftp2) Noop() bool

Sends the FTP NOOP command. This can test whether the control session is still responsive or keep an otherwise idle control connection active.

Returns true for success, false for failure.

top
NoopAsync (1)
func (ftp *Ftp2) NoopAsync(task chan *Task)

Creates an asynchronous task to call the Noop method with the arguments provided.

Returns nil on failure

top
PutFile
func (ftp *Ftp2) PutFile(localFilePath string, remoteFilePath string) bool

Uploads the local filesystem file at localFilePath to the remote path at remoteFilePath. The remote file is created or replaced according to server behavior.

Use RestartNext immediately before this call to request resume of an existing partial remote file. IdleTimeoutMs limits how long the upload may remain blocked without forward progress.

Returns true for success, false for failure.

top
PutFileAsync (1)
func (ftp *Ftp2) PutFileAsync(localFilePath string, remoteFilePath string, task chan *Task)

Creates an asynchronous task to call the PutFile method with the arguments provided.

Returns nil on failure

More Information and Examples
top
PutFileBd
func (ftp *Ftp2) PutFileBd(binData *BinData, remoteFilePath string) bool
Introduced in version 9.5.0.62

Uploads the bytes contained in the BinData object in binData to the remote path at remoteFilePath. No character encoding or line-ending conversion is performed.

Returns true for success, false for failure.

More Information and Examples
top
PutFileBdAsync (1)
func (ftp *Ftp2) PutFileBdAsync(binData *BinData, remoteFilePath string, task chan *Task)
Introduced in version 9.5.0.62

Creates an asynchronous task to call the PutFileBd method with the arguments provided.

Returns nil on failure

top
PutFileFromBinaryData
func (ftp *Ftp2) PutFileFromBinaryData(remoteFilename string, content []byte) bool

Creates or replaces the remote file at remoteFilename with the bytes in content. No character encoding or line-ending conversion is performed.

Returns true for success, false for failure.

More Information and Examples
top
PutFileFromBinaryDataAsync (1)
func (ftp *Ftp2) PutFileFromBinaryDataAsync(remoteFilename string, content []byte, task chan *Task)

Creates an asynchronous task to call the PutFileFromBinaryData method with the arguments provided.

Returns nil on failure

top
PutFileFromTextData
func (ftp *Ftp2) PutFileFromTextData(remoteFilename string, textData string, charset string) bool

Encodes the text in textData using the character encoding named by charset and uploads the resulting bytes to the remote file at remoteFilename.

charset controls the file content encoding. Remote filename encoding is controlled separately by CommandCharset.

Returns true for success, false for failure.

More Information and Examples
top
PutFileFromTextDataAsync (1)
func (ftp *Ftp2) PutFileFromTextDataAsync(remoteFilename string, textData string, charset string, task chan *Task)

Creates an asynchronous task to call the PutFileFromTextData method with the arguments provided.

Returns nil on failure

top
PutFileSb
func (ftp *Ftp2) PutFileSb(sb *StringBuilder, charset string, includeBom bool, remoteFilePath string) bool
Introduced in version 9.5.0.62

Encodes the text in the StringBuilder sb using the charset named by charset and uploads it to the remote path at remoteFilePath. When includeBom is true, a byte-order mark is included when the selected encoding defines one.

Returns true for success, false for failure.

More Information and Examples
top
PutFileSbAsync (1)
func (ftp *Ftp2) PutFileSbAsync(sb *StringBuilder, charset string, includeBom bool, remoteFilePath string, task chan *Task)
Introduced in version 9.5.0.62

Creates an asynchronous task to call the PutFileSb method with the arguments provided.

Returns nil on failure

top
PutPlan
func (ftp *Ftp2) PutPlan(plan string, alreadyDoneFilename string) bool

Executes the upload plan in plan. alreadyDoneFilename is the local path of a completion log; each successful plan operation is recorded there.

To resume an interrupted plan, call this method again with the same plan and log path. Operations already recorded as complete are skipped.

Log durability: Store the completion log on reliable local storage and do not edit it while the plan is running.

Returns true for success, false for failure.

More Information and Examples
top
PutPlanAsync (1)
func (ftp *Ftp2) PutPlanAsync(plan string, alreadyDoneFilename string, task chan *Task)

Creates an asynchronous task to call the PutPlan method with the arguments provided.

Returns nil on failure

top
PutTree
func (ftp *Ftp2) PutTree(localDir string) bool

Uploads the local directory tree rooted at localDir into the current remote directory, creating remote subdirectories as needed. The contents of localDir become children of the current remote directory.

Returns true for success, false for failure.

top
PutTreeAsync (1)
func (ftp *Ftp2) PutTreeAsync(localDir string, task chan *Task)

Creates an asynchronous task to call the PutTree method with the arguments provided.

Returns nil on failure

top
Quote
func (ftp *Ftp2) Quote(cmd string) bool

Sends the raw FTP command text in cmd to the server. Use this for a command not otherwise exposed by the API.

cmd should contain the command and parameters but not the terminating CRLF. The method does not parse command-specific semantics.

Returns true for success, false for failure.

More Information and Examples
top
QuoteAsync (1)
func (ftp *Ftp2) QuoteAsync(cmd string, task chan *Task)

Creates an asynchronous task to call the Quote method with the arguments provided.

Returns nil on failure

top
RemoveRemoteDir
func (ftp *Ftp2) RemoveRemoteDir(remoteDirPath string) bool

Removes the remote directory at remoteDirPath. FTP servers generally require the directory to be empty before it can be removed.

Returns true for success, false for failure.

top
RemoveRemoteDirAsync (1)
func (ftp *Ftp2) RemoveRemoteDirAsync(remoteDirPath string, task chan *Task)

Creates an asynchronous task to call the RemoveRemoteDir method with the arguments provided.

Returns nil on failure

top
RenameRemoteFile
func (ftp *Ftp2) RenameRemoteFile(existingRemoteFilePath string, newRemoteFilePath string) bool

Renames or moves a remote file or directory from existingRemoteFilePath to newRemoteFilePath using the FTP rename sequence. Include directory components in newRemoteFilePath to move the item within the same FTP server.

Returns true for success, false for failure.

top
RenameRemoteFileAsync (1)
func (ftp *Ftp2) RenameRemoteFileAsync(existingRemoteFilePath string, newRemoteFilePath string, task chan *Task)

Creates an asynchronous task to call the RenameRemoteFile method with the arguments provided.

Returns nil on failure

top
SendCommand
func (ftp *Ftp2) SendCommand(cmd string) *string

Sends the raw FTP command in cmd and returns the complete server reply. cmd should not include the terminating CRLF.

The command text is sent as UTF-8. CommandCharset is not applied to this method. Use this method when a raw command or its reply text is required directly.

Returns nil on failure

More Information and Examples
top
SendCommandAsync (1)
func (ftp *Ftp2) SendCommandAsync(cmd string, task chan *Task)

Creates an asynchronous task to call the SendCommand method with the arguments provided.

Returns nil on failure

top
SetModeZ
func (ftp *Ftp2) SetModeZ() bool

Enables MODE Z compression for subsequent data connections. Call this after connecting and only when HasModeZ is true. Uploads, downloads, and directory listings are then transferred through a DEFLATE-compressed stream.

Performance tradeoff: Compression can reduce network traffic for text and other compressible data, but may increase CPU usage and provide little benefit for already-compressed formats such as ZIP, JPEG, or MP4.

Returns true for success, false for failure.

top
SetModeZAsync (1)
func (ftp *Ftp2) SetModeZAsync(task chan *Task)

Creates an asynchronous task to call the SetModeZ method with the arguments provided.

Returns nil on failure

top
SetOldestDateStr
func (ftp *Ftp2) SetOldestDateStr(oldestDateTimeStr string)

Sets the oldest remote modification time eligible for the next DownloadTree operation. oldestDateTimeStr is an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600. Files older than this value are skipped.

top
SetOption
func (ftp *Ftp2) SetOption(option string) bool
Introduced in version 9.5.0.57

Enables or disables a named compatibility option. option identifies the option; prefix the name with No- to disable it.

The recognized option Microsoft-TLS-1.2-Workaround changes data-channel TLS behavior for compatibility with an old Microsoft FTP server defect. It weakens protocol selection and should be used only for the affected legacy server.

Returns true for success, false for failure.

top
SetRemoteFileDateTimeStr
func (ftp *Ftp2) SetRemoteFileDateTimeStr(dateTimeStr string, remoteFilename string) bool

Sets the last-modified time of the remote file at remoteFilename. dateTimeStr is an RFC 822 date-time string, such as Fri, 21 Nov 1997 09:55:06 -0600.

FTP has no universally supported standard command for changing a file timestamp; success depends on server extensions and permissions.

Returns true for success, false for failure.

top
SetRemoteFileDateTimeStrAsync (1)
func (ftp *Ftp2) SetRemoteFileDateTimeStrAsync(dateTimeStr string, remoteFilename string, task chan *Task)

Creates an asynchronous task to call the SetRemoteFileDateTimeStr method with the arguments provided.

Returns nil on failure

top
SetRemoteFileDt
func (ftp *Ftp2) SetRemoteFileDt(dt *CkDateTime, remoteFilename string) bool

Sets the last-modified time of the remote file at remoteFilename from the DateTime object in dt.

FTP has no universally supported standard command for changing a file timestamp; success depends on server extensions and permissions.

Returns true for success, false for failure.

top
SetRemoteFileDtAsync (1)
func (ftp *Ftp2) SetRemoteFileDtAsync(dt *CkDateTime, remoteFilename string, task chan *Task)

Creates an asynchronous task to call the SetRemoteFileDt method with the arguments provided.

Returns nil on failure

top
SetSecurePassword
func (ftp *Ftp2) SetSecurePassword(password *SecureString) bool
Introduced in version 9.5.0.76

Copies the password from the SecureString in password for subsequent FTP authentication. This avoids exposing the password as an ordinary immutable language string. It is equivalent to setting Password for login behavior.

Returns true for success, false for failure.

top
SetSslCertRequirement
func (ftp *Ftp2) SetSslCertRequirement(reqName string, reqValue string)

Adds a required match against the FTP server certificate. reqName selects the certificate field and reqValue specifies the required value. Supported field names include SubjectDN, SubjectCN, IssuerDN, IssuerCN, and SAN. Wildcards may be used in reqValue.

The TLS connection is rejected when the presented certificate does not satisfy the requirement.

Additional check: Certificate requirements supplement normal certificate validation; they should not be used as a substitute for trust-chain, validity, and hostname verification.

top
SetSslClientCert
func (ftp *Ftp2) SetSslClientCert(cert *Cert) bool

Configures the Cert in cert as the client certificate for FTPS servers that request mutual TLS authentication. The certificate must have access to its private key.

Returns true for success, false for failure.

top
SetSslClientCertPem
func (ftp *Ftp2) SetSslClientCertPem(pemDataOrFilename string, pemPassword string) bool

Configures a client certificate and private key from PEM data or a PEM file. pemDataOrFilename may contain the PEM text or the local filesystem path of a PEM file. pemPassword is the private-key password, or an empty string when the key is not encrypted.

Returns true for success, false for failure.

top
SetSslClientCertPfx
func (ftp *Ftp2) SetSslClientCertPfx(pfxFilename string, pfxPassword string) bool

Loads a client certificate and private key from the local PFX/P12 file at pfxFilename. pfxPassword is the file password. The certificate is used when the FTPS server requests mutual TLS authentication.

Returns true for success, false for failure.

top
SetTypeAscii
func (ftp *Ftp2) SetTypeAscii() bool

Sets the FTP representation type to ASCII for subsequent transfers. In ASCII mode, the FTP endpoints may translate line endings, and CrlfMode can apply additional conversion on downloads.

Use carefully: ASCII mode is intended for text. Use SetTypeBinary for executables, archives, images, encrypted data, and any file whose bytes must remain unchanged.

Returns true for success, false for failure.

top
SetTypeAsciiAsync (1)
func (ftp *Ftp2) SetTypeAsciiAsync(task chan *Task)

Creates an asynchronous task to call the SetTypeAscii method with the arguments provided.

Returns nil on failure

top
SetTypeBinary
func (ftp *Ftp2) SetTypeBinary() bool

Sets the FTP representation type to binary (TYPE I) for subsequent transfers. Binary mode preserves file bytes and is the appropriate default for nearly all modern file types.

Returns true for success, false for failure.

top
SetTypeBinaryAsync (1)
func (ftp *Ftp2) SetTypeBinaryAsync(task chan *Task)

Creates an asynchronous task to call the SetTypeBinary method with the arguments provided.

Returns nil on failure

top
Site
func (ftp *Ftp2) Site(siteCommand string) bool

Sends a server-specific SITE command. siteCommand contains the text following SITE, for example RECFM=FB LRECL=600.

SITE subcommands are defined by the server, not by the FTP standard, and may require special permissions.

Returns true for success, false for failure.

top
SiteAsync (1)
func (ftp *Ftp2) SiteAsync(siteCommand string, task chan *Task)

Creates an asynchronous task to call the Site method with the arguments provided.

Returns nil on failure

top
SleepMs
func (ftp *Ftp2) SleepMs(millisec int)

Blocks the calling thread for millisec milliseconds. This is a utility method and performs no FTP network operation.

top
Stat
func (ftp *Ftp2) Stat() *string

Sends the FTP STAT command and returns the server's reply. Depending on the server and session state, the reply may contain status information or a directory listing.

Returns nil on failure

top
StatAsync (1)
func (ftp *Ftp2) StatAsync(task chan *Task)

Creates an asynchronous task to call the Stat method with the arguments provided.

Returns nil on failure

top
SyncDeleteRemote
func (ftp *Ftp2) SyncDeleteRemote(localRoot string) bool

Recursively compares the remote tree rooted at the current remote directory with the local tree rooted at localRoot and deletes remote files that have no corresponding local file. The synchronization file and directory filters apply. Empty remote directories are not deleted.

Destructive synchronization: This method deletes server data. Verify the current remote directory, local root, and synchronization filters before calling it.

Use GetSyncedFiles after the call to obtain the relative paths deleted.

Returns true for success, false for failure.

top
SyncDeleteRemoteAsync (1)
func (ftp *Ftp2) SyncDeleteRemoteAsync(localRoot string, task chan *Task)

Creates an asynchronous task to call the SyncDeleteRemote method with the arguments provided.

Returns nil on failure

top
SyncLocalDir
func (ftp *Ftp2) SyncLocalDir(localRoot string, mode int) bool

Synchronizes files from the current remote directory into the local directory at localRoot without descending into subdirectories. mode selects the same download mode documented for SyncLocalTree. Use GetSyncedFiles afterward to obtain the affected relative paths.

Returns true for success, false for failure.

More Information and Examples
top
SyncLocalDirAsync (1)
func (ftp *Ftp2) SyncLocalDirAsync(localRoot string, mode int, task chan *Task)

Creates an asynchronous task to call the SyncLocalDir method with the arguments provided.

Returns nil on failure

top
SyncLocalTree
func (ftp *Ftp2) SyncLocalTree(localRoot string, mode int) bool

Synchronizes the remote tree rooted at the current remote directory into the local directory at localRoot. mode selects which files are downloaded or deleted.

ModeAction
0Download all selected files.
1Download files missing locally.
2Download files that are missing locally or newer on the server.
3Download only files that already exist locally and are newer on the server.
5Download files that are missing locally or have a different size.
6Download files that are missing, have a different size, or are newer on the server.
99Do not download; delete remote files that do not exist locally.

The synchronization filters apply, and GetSyncedFiles returns the relative paths affected by the operation.

Time comparison: Newer-file modes depend on remote timestamps and local clock interpretation. Size-based modes may be more predictable when server timestamp precision is limited.

Returns true for success, false for failure.

More Information and Examples
top
SyncLocalTreeAsync (1)
func (ftp *Ftp2) SyncLocalTreeAsync(localRoot string, mode int, task chan *Task)

Creates an asynchronous task to call the SyncLocalTree method with the arguments provided.

Returns nil on failure

top
SyncRemoteTree
func (ftp *Ftp2) SyncRemoteTree(localRoot string, mode int) bool

Synchronizes the local tree rooted at localRoot into the current remote directory. mode selects which files are uploaded.

ModeAction
0Upload all selected files.
1Upload files missing on the server.
2Upload files that are missing or newer locally.
3Upload only files that already exist remotely and are newer locally.
4Upload files that are missing or have a different size.
5Upload files that are missing, have a different size, or are newer locally.

The synchronization filters apply, and GetSyncedFiles returns the relative paths uploaded.

Returns true for success, false for failure.

More Information and Examples
top
SyncRemoteTreeAsync (1)
func (ftp *Ftp2) SyncRemoteTreeAsync(localRoot string, mode int, task chan *Task)

Creates an asynchronous task to call the SyncRemoteTree method with the arguments provided.

Returns nil on failure

top
SyncRemoteTree2
func (ftp *Ftp2) SyncRemoteTree2(localDirPath string, mode int, bDescend bool, bPreviewOnly bool) bool

Provides the upload synchronization behavior of SyncRemoteTree with traversal and preview controls. localDirPath is the local root, mode is the synchronization mode, bDescend controls whether subdirectories are traversed, and bPreviewOnly selects preview-only mode. The file and directory synchronization filters apply in both normal and preview operation.

When bPreviewOnly is true, files are not uploaded and the absolute candidate file paths are placed in SyncPreview. Required remote directories may still be created during the preview.

Returns true for success, false for failure.

top
SyncRemoteTree2Async (1)
func (ftp *Ftp2) SyncRemoteTree2Async(localDirPath string, mode int, bDescend bool, bPreviewOnly bool, task chan *Task)

Creates an asynchronous task to call the SyncRemoteTree2 method with the arguments provided.

Returns nil on failure

top
Syst
func (ftp *Ftp2) Syst() *string

Sends SYST and returns the server's operating-system type reply. Chilkat can use this information when interpreting legacy directory listings.

Returns nil on failure

top
SystAsync (1)
func (ftp *Ftp2) SystAsync(task chan *Task)

Creates an asynchronous task to call the Syst method with the arguments provided.

Returns nil on failure

top

Deprecated

AsyncBytesReceived
func (ftp *Ftp2) AsyncBytesReceived() uint
This property is deprecated. It will be removed in a future version.

Deprecated. Returns the number of bytes received during the current FTP download as a 32-bit unsigned integer. The value is updated while the transfer is running. Use CurBytesReceived instead.

top
AsyncBytesReceived64
func (ftp *Ftp2) AsyncBytesReceived64() int64
This property is deprecated. It will be removed in a future version.

Deprecated. Returns the number of bytes received during the current FTP download as a 64-bit integer. The value is updated while the transfer is running. Use CurBytesReceived64 instead.

top
AsyncBytesSent
func (ftp *Ftp2) AsyncBytesSent() uint
This property is deprecated. It will be removed in a future version.

Deprecated. Returns the number of bytes sent during the current FTP upload as a 32-bit unsigned integer. The value is updated while the transfer is running. Use CurBytesSent instead.

top
AsyncBytesSent64
func (ftp *Ftp2) AsyncBytesSent64() int64
This property is deprecated. It will be removed in a future version.

Deprecated. Returns the number of bytes sent during the current FTP upload as a 64-bit integer. The value is updated while the transfer is running. Use CurBytesSent64 instead.

top
DetermineProxyMethod
func (ftp *Ftp2) DetermineProxyMethod() int
This method is deprecated.

Deprecated. Tries the supported traditional FTP-proxy login sequences and returns the first successful ProxyMethod value. Returns 0 when none succeeds and -1 when the test cannot be completed.

More Information and Examples
top
DetermineProxyMethodAsync (1)
func (ftp *Ftp2) DetermineProxyMethodAsync(task chan *Task)
This method is deprecated.

Creates an asynchronous task to call the DetermineProxyMethod method with the arguments provided.

Returns nil on failure

top
DetermineSettings
func (ftp *Ftp2) DetermineSettings() *string
This method is deprecated.

Deprecated. Tests combinations of Ssl, AuthTls, AuthSsl, Port, Passive, and PassiveUseHostAddr by attempting a directory listing, then returns an XML report.

The method performs multiple network attempts and can take significant time. Prefer configuring the connection explicitly from the server's documented FTP/FTPS settings.

Returns nil on failure

More Information and Examples
top
DetermineSettingsAsync (1)
func (ftp *Ftp2) DetermineSettingsAsync(task chan *Task)
This method is deprecated.

Creates an asynchronous task to call the DetermineSettings method with the arguments provided.

Returns nil on failure

top
GetCreateDt
func (ftp *Ftp2) GetCreateDt(index int) *CkDateTime
This method is deprecated and replaced by GetCreateTimeStr

Deprecated. Returns a new DateTime containing the creation time for cached directory-listing entry index. Use GetCreateTimeStr when a string result is preferred. index is a zero-based index from 0 through one less than GetDirCount.

Returns nil on failure

top
GetCreateDtAsync (1) (2)
func (ftp *Ftp2) GetCreateDtAsync(index int, task chan *Task)
This method is deprecated and replaced by GetCreateTimeStr

Creates an asynchronous task to call the GetCreateDt method with the arguments provided.

Returns nil on failure

top
GetCreateDtByName
func (ftp *Ftp2) GetCreateDtByName(filename string) *CkDateTime
This method is deprecated and replaced by GetCreateTimeByNameStr

Deprecated. Returns a new DateTime containing the creation time for the file or directory named by filename in the current remote directory. Use GetCreateTimeByNameStr when a string result is preferred.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name so the item is present in the cached listing.

Creation times: Many UNIX-like filesystems and FTP listing formats do not provide a file creation time. In that case the server or parser may report the modification time instead.

Returns nil on failure

top
GetCreateDtByNameAsync (1) (2)
func (ftp *Ftp2) GetCreateDtByNameAsync(filename string, task chan *Task)
This method is deprecated and replaced by GetCreateTimeByNameStr

Creates an asynchronous task to call the GetCreateDtByName method with the arguments provided.

Returns nil on failure

top
GetLastModDt
func (ftp *Ftp2) GetLastModDt(index int) *CkDateTime
This method is deprecated and replaced by GetLastModifiedTimeStr

Deprecated. Returns a new DateTime containing the last-modified time for cached directory-listing entry index. Use GetLastModifiedTimeStr when a string result is preferred.

Returns nil on failure

top
GetLastModDtAsync (1) (2)
func (ftp *Ftp2) GetLastModDtAsync(index int, task chan *Task)
This method is deprecated and replaced by GetLastModifiedTimeStr

Creates an asynchronous task to call the GetLastModDt method with the arguments provided.

Returns nil on failure

top
GetLastModDtByName
func (ftp *Ftp2) GetLastModDtByName(filename string) *CkDateTime
This method is deprecated and replaced by GetLastModifiedTimeByNameStr

Deprecated. Returns a new DateTime containing the last-modified time for the item named by filename in the current remote directory. Use GetLastModifiedTimeByNameStr when a string result is preferred.

filename must be a name, not a path. Set the current remote directory first, and ensure ListPattern matches the name.

Returns nil on failure

top
GetLastModDtByNameAsync (1) (2)
func (ftp *Ftp2) GetLastModDtByNameAsync(filename string, task chan *Task)
This method is deprecated and replaced by GetLastModifiedTimeByNameStr

Creates an asynchronous task to call the GetLastModDtByName method with the arguments provided.

Returns nil on failure

top
GetSslServerCert
func (ftp *Ftp2) GetSslServerCert() *Cert
This method is deprecated and replaced by GetServerCert

Deprecated. Returns a new Cert containing the certificate presented by the FTP server during the current or most recent TLS connection. Use GetServerCert instead.

Returns nil on failure

top