Class Ftp2
- All Implemented Interfaces:
AutoCloseable
Connect, secure, transfer, synchronize, and manage files on FTP servers.
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.
Protocol note:
Ftp2 implements FTP and FTP over TLS (FTPS). It does not implement
SSH File Transfer Protocol. Use SFtp when the server requires SFTP over SSH.
Stateful session:
One Ftp2 object represents one FTP session with a current remote
directory, transfer type, detected server capabilities, and a cached directory
listing. FTP commands and replies use the persistent control connection, while
each listing, upload, or download uses a separate data connection.
Paths and encodings:
Remote paths are interpreted by the FTP server and are normally relative to the
current remote directory unless the server recognizes an absolute path. Remote
command text uses CommandCharset, directory-listing bytes use
DirListingCharset, and text-transfer methods use their own content
charset argument.
Partial operations: FTP operations are not transactional. A transfer, recursive operation, deletion, or synchronization can complete some work before a later step fails. Chilkat does not generally roll back completed filesystem or server changes and does not automatically retry or resume a failed transfer unless the application explicitly uses the resume features.
Server variability:
FTP extensions and server behavior vary. Features such as MLSD,
EPSV, MODE Z, checksum commands, timestamp-setting
commands, wildcard matching, and rename-overwrite behavior depend on the server.
Inspect LastReply, LastErrorText, and the session log when behavior
differs between servers.
FTPS certificate verification:
RequireSslCertVerify defaults to false. Production FTPS clients
should normally enable certificate-chain verification and use the expected
server hostname. Certificate pinning and certificate requirements are additional
checks and do not replace normal trust and hostname validation.
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.
For an extended overview, see Ftp2 Class Overview.
</section>
Event-capable: long-running methods report progress through a ProgressListener installed
with setProgressListener(ProgressListener), onAbortCheck(BooleanSupplier),
onPercentDone(IntPredicate) or onProgressInfo(BiConsumer).
Instances hold a native Chilkat object: close them with ChilkatObject.close() (try-with-resources) when
done; an unclosed instance is freed when it becomes unreachable.
- See Also:
- Online reference
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendFile(String localFilePath, String remoteFilePath)Appends the contents of the local file atlocalFilePathto the remote file atremoteFilePath.voidappendFileBd(String remoteFilename, BinData bd)Appends the bytes in theBinDataobjectbdto the remote file atremoteFilename.voidappendFileFromTextData(String remoteFilename, String textData, String charset)Encodes the text intextDatausing the character encoding named bycharsetand appends the resulting bytes to the remote file atremoteFilename.voidappendFileSb(String remoteFilename, StringBuilder sb, String charset)Encodes the text in theStringBuildersbusing the charset named bycharsetand appends the resulting bytes to the remote file atremoteFilename.voidchangeRemoteDir(String remoteDirPath)Changes the current working directory on the FTP server toremoteDirPath.booleanReturns whether Chilkat currently considers the FTP control connection to be open.voidRequests that an explicit-FTPS control connection return to clear text after authentication.voidClears the cached listing for the current remote directory.voidClears the in-memory FTP protocol log collected whileis enabled.getKeepSessionLog()voidconnect()Connects to the server specified byandgetHostname(), negotiates any configured proxy and TLS layer, receives the FTP greeting, and authenticates usinggetPort(),getUsername(), andgetPassword().getAccount()voidEstablishes the configured proxy and TCP connection, performs any configured implicit or explicit TLS setup, and receives the FTP server greeting, but does not sendUSERorPASS.voidUpgrades an already-connected clear FTP control channel to explicit TLS.createPlan(String localDir)Creates and returns a textual upload plan for the local directory atlocalDir.voidcreateRemoteDir(String remoteDirPath)Creates the remote directory atremoteDirPathby sending oneMKDcommand.intdeleteMatching(String remotePattern)Deletes files in the current remote directory whose names match the wildcard pattern inremotePattern.voiddeleteRemoteFile(String remoteFilePath)Deletes the remote file atremoteFilePath.voidRecursively deletes the files and subdirectories beneath the current remote directory.Returns an XML representation of the complete remote directory tree rooted at the current remote directory.voidEnds the FTP session and closes the control connection.voiddownloadTree(String localRoot)Downloads all selected files and subdirectories beneath the current remote directory and recreates the tree under the local directory atlocalRoot.feat()SendsFEATand returns the server's multiline capability reply.booleanSet totrueto request cancellation of the operation currently running on this object.Very rarely needed today: Almost all modern FTP servers rely exclusively on theUSERandPASScommands for authentication and access control.intSpecifies the last local TCP port that may be used for active-mode data connections.intSpecifies the first local TCP port that may be used for active-mode data connections.longRarely needed: The FTPALLOcommand pre-allocates disk space on the server before an upload.booleanControls whether machine-readable directory listings are requested withMLSDwhen the server advertises support.booleanLegacy and very uncommon:AUTH SSLoriginated in early FTP security drafts from the era when SSL was the standard encryption protocol.booleanSet totrueto use explicit FTP over TLS by sendingAUTH TLSon the FTP control channel.booleanRarely changed: Leave this property at its default value oftruefor nearly all modern FTP servers.booleanControls automatic adjustment of,getSsl(), andgetAuthSsl()based solely ongetAuthTls().getPort()booleanControls whether Chilkat sends aSIZEcommand before a download so percentage-based progress can be calculated.booleanControls whetherOPTS UTF8 ONis sent automatically when a processedFEATresponse advertisesUTF8.booleanRecommended setting: Applications should set this property totrue.booleanControls whether aSYSTcommand is sent automatically after login.booleanControls automatic post-upload verification with the server-specificXCRCcommand.intSpecifies the approximate maximum download rate in bytes per second.intSpecifies the approximate maximum upload rate in bytes per second.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.Specifies the character encoding used by high-level FTP operations for commands containing non-ASCII text, including remote paths and filenames.intContains a numeric reason code afterorconnect()fails.connectOnly()intSpecifies the maximum number of seconds to wait for a remote endpoint to accept a TCP connection.booleanIndicates whether the TCP connection to the FTP server was successfully established during the most recent connection attempt.getCreateTimeByNameStr(String filename)Returns the creation time for the file or directory named byfilenamein the current remote directory as an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.getCreateTimeStr(int index)Returns the creation time for cached directory-listing entryindexas an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.intControls line-ending conversion when downloading in ASCII transfer mode.longReturns the number of bytes received by the current or most recently completed FTP download as a 32-bit unsigned integer.longReturns the number of bytes received by the current or most recently completed FTP download as a 64-bit integer.Returns the number of bytes received by the current or most recently completed FTP download as a decimal string.longReturns the number of bytes sent by the current or most recently completed FTP upload as a 32-bit unsigned integer.longReturns the number of bytes sent by the current or most recently completed FTP upload as a 64-bit integer.Returns the number of bytes sent by the current or most recently completed FTP upload as a decimal string.Returns the current working directory reported by the FTP server, normally by using thePWDcommand.Specifies the protection level for FTP data connections.intReturns the number of files and directories in the cached listing of the current remote directory after applying the case-insensitive.getListPattern()Specifies the character encoding used only to decode directory-listing and related server-response bytes.intReturns the current average download rate in bytes per second.booleanControls automatic resolution of credential values from secure operating-system storage.voidDownloads the remote file atremoteFilePathto the local filesystem path atlocalFilePath.voidDownloads the remote file atremoteFilePathand appends its bytes to the existing contents of theBinDataobject inbinData.getFilename(int index)Returns the name of cached directory-listing entryindex.voidgetFileSb(String remoteFilePath, String charset, StringBuilder sb)Downloads the remote file atremoteFilePath, decodes its bytes using the charset named bycharset, and appends the resulting text to the existing contents of theStringBuilderinsb.voidgetFileToStream(String remoteFilePath, Stream toStream)Downloads the remote file atremoteFilePathand writes its bytes to theStreamintoStream.Specifies the IPv4 address advertised to the server for active-mode data connections.Contains the initial FTP server greeting received for the most recent connection immediately after the TCP or implicit-TLS connection was established.getGroup(int index)Returns the group name or identifier for cached directory-listing entryindex.booleanIndicates whether the FTP server advertised support forMODE Z, which compresses FTP data streams using the DEFLATE algorithm.intSpecifies the interval, in milliseconds, betweencallbacks during methods that support periodic cancellation checks.AbortCheckSpecifies the FTP server hostname or numeric IPv4/IPv6 address.Specifies the authentication method used with an HTTP proxy.Specifies the Windows domain used for NTLM authentication to the HTTP proxy.Specifies the hostname or numeric IP address of an HTTP proxy used to establish the FTP control connection.Specifies the password used to authenticate to the HTTP proxy.intSpecifies the TCP port of the HTTP proxy.Specifies the username used to authenticate to the HTTP proxy.intSpecifies the maximum period, in milliseconds, during which no control-channel response or forward upload progress is observed.booleanDeprecated.booleangetIsDirectory(int index)Returnstruewhen cached directory-listing entryindexis identified as a directory.booleangetIsSymbolicLink(int index)Returnstruewhen cached directory-listing entryindexis identified as a symbolic link.booleanControls collection of an in-memory FTP protocol log.booleanControls an additional keepalive measure for very long uploads and downloads.voidgetLastJsonData(JsonObject json)Copies structured supplemental JSON produced by the immediately preceding method into theJsonObjectinjson.getLastModifiedTimeByNameStr(String filename)Returns the last-modified time for the item named byfilenamein the current remote directory as an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.getLastModifiedTimeStr(int index)Returns the last-modified time for cached directory-listing entryindexas an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.Contains the most recent FTP control-channel reply, including its three-digit status code and message.Specifies an option string appended literally to the legacyLISTcommand, such as-a.Specifies the case-insensitive wildcard pattern applied to the cached listing of the current remote directory.booleanIndicates whether FTP authentication succeeded during the most recent login attempt.getOwner(int index)Returns the owner name or identifier for cached directory-listing entryindex.booleanIndicates whether the most recent download method received some, but not all, of the remote file.booleanSelects the FTP data-connection mode.booleanControls how the address returned byPASVis handled.Specifies the password used for FTP authentication.intSpecifies the integer value that represents 100 percent inPercentDonecallbacks.getPermissions(int index)Returns the permissions or status string for cached directory-listing entryindex.getPermType(int index)Returns the format identifier for the permissions string available for cached listing entryindex.intgetPort()Specifies the FTP server port.booleanControls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses.booleanControls whetherNLSTis preferred overLISTwhen a legacy directory listing is required.Returns the installed listener, ornull.intSpecifies the expected size, in bytes, of the next file downloaded bywhen the size is not otherwise known.getFile(String, String)longThe 64-bit form of.getProgressMonSize()Specifies the hostname or IP address of a traditional FTP application proxy or firewall.intSelects the login sequence required by a traditional FTP proxy or firewall.Specifies the password used to authenticate to a traditional FTP proxy or firewall.intSpecifies the TCP port on which the traditional FTP proxy or firewall accepts connections.Specifies the username used to authenticate to a traditional FTP proxy or firewall.intSpecifies the maximum number of seconds that a data connection may remain without receiving another byte.getRemoteFileTextC(String remoteFilename, String charset)Downloads the remote file atremoteFilename, decodes the bytes using the character encoding named bycharset, and returns the text.getRemoteFileTextData(String remoteFilename)Downloads the remote file atremoteFilenameand returns its contents decoded using the ANSI character encoding.booleanControls verification of the FTP server's TLS certificate chain.booleanSet totrueto request that the next applicable upload or download resume from existing content instead of starting over.voidgetServerCert(Cert cert)Loads into theCertobject incertthe leaf certificate presented on the currently connected FTPS control channel.Contains the in-memory FTP session log collected whileisgetKeepSessionLog()true.intgetSize(int index)Returns the size in bytes of cached directory-listing entryindexas a 32-bit integer.longgetSize64(int index)Returns the size in bytes of cached directory-listing entryindexas a 64-bit integer.intgetSizeByName(String filename)Returns the size in bytes of the file named byfilenamein the current remote directory as a 32-bit integer.longgetSizeByName64(String filename)Sends aSIZEcommand forfilenameand returns the remote size in bytes as a 64-bit integer.getSizeStr(int index)Returns the size in bytes of cached directory-listing entryindexas a decimal string.getSizeStrByName(String filename)Returns the size in bytes of the file named byfilenamein the current remote directory as a decimal string.Specifies the hostname or IP address of the SOCKS proxy.Specifies the password for SOCKS5 username/password authentication.intSpecifies the SOCKS proxy port.Specifies the SOCKS user identifier.intSelects SOCKS proxy usage.intSpecifies the socket receive-buffer size.intSpecifies the socket send-buffer size.booleangetSsl()Set totrueto use implicit FTP over TLS.Restricts the cipher suites and selected TLS security requirements offered for FTP TLS connections.Selects the TLS protocol version or minimum version allowed for secure FTP connections.booleanIndicates whether the FTP server certificate chain was successfully verified for the current or most recent TLS connection.booleanControls whether download synchronization creates empty remote directories on the local filesystem.voidgetSyncedFiles(StringTable strTable)Appends to theStringTableinstrTablethe relative paths affected by the most recent synchronization operation.Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that are eligible for synchronization and tree operations.Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods are allowed to enter.Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that must be excluded from synchronization and tree operations.Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods must not enter.Contains the preview produced bywhen ARG4 issyncRemoteTree2(String, int, boolean, boolean)true.getTextDirListing(String pattern)Sends a legacyLISTrequest and returns the server's raw textual listing.Contains the cipher suite negotiated for the current or most recent successful TLS connection, such asTLS_AES_256_GCM_SHA384.Specifies one or more expected Subject Public Key Info (SPKI) fingerprints for TLS public-key pinning.Contains the protocol version negotiated for the current or most recent successful TLS connection, such asTLS 1.2orTLS 1.3.Provides a comma-separated list of compatibility options for uncommon platform or server requirements.intReturns the current average upload rate in bytes per second.booleanControls whether passive data connections first useEPSVinstead ofPASV.Specifies the FTP login name.getXmlDirListing(String pattern)Retrieves a directory listing forpatternand returns parsed entries as an XML document rooted at<remoteDir>.voidlargeFileUpload(String localPath, String remotePath, int chunkSize)Uploads the local file atlocalPathto the remote path atremotePathas a sequence of data transfers, each containing up tochunkSizebytes.voidAuthenticates an FTP control connection previously established by.connectOnly()intDownloads files in the current remote directory that matchremotePatterninto the existing local directory atlocalDir.intUploads each local file matchingpatternto the current remote directory.SendsNLSTwithremoteDirPatternappended literally and returns the names in XML form.voidnoop()Sends the FTPNOOPcommand.voidonAbortCheck(BooleanSupplier callback)Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it.voidonPercentDone(IntPredicate callback)Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it.voidonProgressInfo(BiConsumer<String,String> callback)Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds.voidUploads the local filesystem file atlocalFilePathto the remote path atremoteFilePath.voidUploads the bytes contained in theBinDataobject inbinDatato the remote path atremoteFilePath.voidputFileFromTextData(String remoteFilename, String textData, String charset)Encodes the text intextDatausing the character encoding named bycharsetand uploads the resulting bytes to the remote file atremoteFilename.voidputFileSb(StringBuilder sb, String charset, boolean includeBom, String remoteFilePath)Encodes the text in theStringBuildersbusing the charset named bycharsetand uploads it to the remote path atremoteFilePath.voidExecutes the upload plan inplan.voidUploads the local directory tree rooted atlocalDirinto the current remote directory, creating remote subdirectories as needed.voidSends the raw FTP command text incmdto the server.voidremoveRemoteDir(String remoteDirPath)Removes the remote directory atremoteDirPath.voidrenameRemoteFile(String existingRemoteFilePath, String newRemoteFilePath)Renames or moves a remote file or directory fromexistingRemoteFilePathtonewRemoteFilePathusing the FTPRNFR/RNTOsequence.sendCommand(String cmd)Sends the raw FTP command incmdand returns the complete server reply.voidsetAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().voidsetAccount(String value)Sets theAccountproperty; seegetAccount().voidsetActivePortRangeEnd(int value)Sets theActivePortRangeEndproperty; seegetActivePortRangeEnd().voidsetActivePortRangeStart(int value)Sets theActivePortRangeStartproperty; seegetActivePortRangeStart().voidsetAllocateSize(long value)Sets theAllocateSizeproperty; seegetAllocateSize().voidsetAllowMlsd(boolean value)Sets theAllowMlsdproperty; seegetAllowMlsd().voidsetAuthSsl(boolean value)Sets theAuthSslproperty; seegetAuthSsl().voidsetAuthTls(boolean value)Sets theAuthTlsproperty; seegetAuthTls().voidsetAutoFeat(boolean value)Sets theAutoFeatproperty; seegetAutoFeat().voidsetAutoFix(boolean value)Sets theAutoFixproperty; seegetAutoFix().voidsetAutoGetSizeForProgress(boolean value)Sets theAutoGetSizeForProgressproperty; seegetAutoGetSizeForProgress().voidsetAutoOptsUtf8(boolean value)Sets theAutoOptsUtf8property; seegetAutoOptsUtf8().voidsetAutoSetUseEpsv(boolean value)Sets theAutoSetUseEpsvproperty; seegetAutoSetUseEpsv().voidsetAutoSyst(boolean value)Sets theAutoSystproperty; seegetAutoSyst().voidsetAutoXcrc(boolean value)Sets theAutoXcrcproperty; seegetAutoXcrc().voidsetBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().voidsetBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().voidsetClientIpAddress(String value)Sets theClientIpAddressproperty; seegetClientIpAddress().voidsetCommandCharset(String value)Sets theCommandCharsetproperty; seegetCommandCharset().voidsetConnectTimeout(int value)Sets theConnectTimeoutproperty; seegetConnectTimeout().voidsetCrlfMode(int value)Sets theCrlfModeproperty; seegetCrlfMode().voidsetDataProtection(String value)Sets theDataProtectionproperty; seegetDataProtection().voidsetDirListingCharset(String value)Sets theDirListingCharsetproperty; seegetDirListingCharset().voidsetEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().voidsetForcePortIpAddress(String value)Sets theForcePortIpAddressproperty; seegetForcePortIpAddress().voidsetHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().voidsetHostname(String value)Sets theHostnameproperty; seegetHostname().voidsetHttpProxyAuthMethod(String value)Sets theHttpProxyAuthMethodproperty; seegetHttpProxyAuthMethod().voidsetHttpProxyDomain(String value)Sets theHttpProxyDomainproperty; seegetHttpProxyDomain().voidsetHttpProxyHostname(String value)Sets theHttpProxyHostnameproperty; seegetHttpProxyHostname().voidsetHttpProxyPassword(String value)Sets theHttpProxyPasswordproperty; seegetHttpProxyPassword().voidsetHttpProxyPort(int value)Sets theHttpProxyPortproperty; seegetHttpProxyPort().voidsetHttpProxyUsername(String value)Sets theHttpProxyUsernameproperty; seegetHttpProxyUsername().voidsetIdleTimeoutMs(int value)Sets theIdleTimeoutMsproperty; seegetIdleTimeoutMs().voidsetKeepSessionLog(boolean value)Sets theKeepSessionLogproperty; seegetKeepSessionLog().voidsetLargeFileMeasures(boolean value)Sets theLargeFileMeasuresproperty; seegetLargeFileMeasures().voidsetListOption(String value)Sets theListOptionproperty; seegetListOption().voidsetListPattern(String value)Sets theListPatternproperty; seegetListPattern().voidsetModeZ()EnablesMODE Zcompression for subsequent data connections.voidsetOldestDateStr(String oldestDateTimeStr)Sets the oldest remote modification time eligible for.downloadTree(String)voidEnables or disables a named compatibility option.voidsetPassive(boolean value)Sets thePassiveproperty; seegetPassive().voidsetPassiveUseHostAddr(boolean value)Sets thePassiveUseHostAddrproperty; seegetPassiveUseHostAddr().voidsetPassword(String value)Sets thePasswordproperty; seegetPassword().voidsetPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().voidsetPort(int value)Sets thePortproperty; seegetPort().voidsetPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().voidsetPreferNlst(boolean value)Sets thePreferNlstproperty; seegetPreferNlst().voidsetProgressListener(ProgressListener listener)Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.voidsetProgressMonSize(int value)Sets theProgressMonSizeproperty; seegetProgressMonSize().voidsetProgressMonSize64(long value)Sets theProgressMonSize64property; seegetProgressMonSize64().voidsetProxyHostname(String value)Sets theProxyHostnameproperty; seegetProxyHostname().voidsetProxyMethod(int value)Sets theProxyMethodproperty; seegetProxyMethod().voidsetProxyPassword(String value)Sets theProxyPasswordproperty; seegetProxyPassword().voidsetProxyPort(int value)Sets theProxyPortproperty; seegetProxyPort().voidsetProxyUsername(String value)Sets theProxyUsernameproperty; seegetProxyUsername().voidsetReadTimeout(int value)Sets theReadTimeoutproperty; seegetReadTimeout().voidsetRemoteFileDateTimeStr(String dateTimeStr, String remoteFilename)Sets the last-modified time of the remote file atremoteFilename.voidsetRemoteFileDt(DateTime dt, String remoteFilename)Sets the last-modified time of the remote file atremoteFilenameusing theCkDateTimeindt.voidsetRequireSslCertVerify(boolean value)Sets theRequireSslCertVerifyproperty; seegetRequireSslCertVerify().voidsetRestartNext(boolean value)Sets theRestartNextproperty; seegetRestartNext().voidsetSecurePassword(SecureString password)Copies the password from theSecureStringinpasswordfor subsequent FTP authentication.voidsetSocksHostname(String value)Sets theSocksHostnameproperty; seegetSocksHostname().voidsetSocksPassword(String value)Sets theSocksPasswordproperty; seegetSocksPassword().voidsetSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().voidsetSocksUsername(String value)Sets theSocksUsernameproperty; seegetSocksUsername().voidsetSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().voidsetSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().voidsetSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().voidsetSsl(boolean value)Sets theSslproperty; seegetSsl().voidsetSslAllowedCiphers(String value)Sets theSslAllowedCiphersproperty; seegetSslAllowedCiphers().voidsetSslCertRequirement(String reqName, String reqValue)Adds a required match against the FTP server certificate.voidsetSslClientCert(Cert cert)Configures theCertincertas the client certificate for FTPS servers that request mutual TLS authentication.voidsetSslClientCertPem(String pemDataOrFilename, String pemPassword)Configures a client certificate and private key from PEM data or a PEM file.voidsetSslClientCertPfx(String pfxFilename, String pfxPassword)Loads a client certificate and private key from the local PFX/P12 file atpfxFilename.voidsetSslProtocol(String value)Sets theSslProtocolproperty; seegetSslProtocol().voidsetSyncCreateAllLocalDirs(boolean value)Sets theSyncCreateAllLocalDirsproperty; seegetSyncCreateAllLocalDirs().voidsetSyncMustMatch(String value)Sets theSyncMustMatchproperty; seegetSyncMustMatch().voidsetSyncMustMatchDir(String value)Sets theSyncMustMatchDirproperty; seegetSyncMustMatchDir().voidsetSyncMustNotMatch(String value)Sets theSyncMustNotMatchproperty; seegetSyncMustNotMatch().voidsetSyncMustNotMatchDir(String value)Sets theSyncMustNotMatchDirproperty; seegetSyncMustNotMatchDir().voidsetTlsPinSet(String value)Sets theTlsPinSetproperty; seegetTlsPinSet().voidSets the FTP representation type to ASCII for subsequent transfers.voidSets the FTP representation type to binary (TYPE I) for subsequent transfers.voidsetUncommonOptions(String value)Sets theUncommonOptionsproperty; seegetUncommonOptions().voidsetUseEpsv(boolean value)Sets theUseEpsvproperty; seegetUseEpsv().voidsetUsername(String value)Sets theUsernameproperty; seegetUsername().voidSends a server-specificSITEcommand.voidsleepMs(int millisec)Blocks the calling thread formillisecmilliseconds.stat()Sends the FTPSTATcommand and returns the server's reply.voidsyncDeleteRemote(String localRoot)Recursively compares the remote tree rooted at the current remote directory with the local tree rooted atlocalRootand deletes remote files that have no corresponding local file.voidsyncLocalDir(String localRoot, int mode)Synchronizes files from the current remote directory into the local directory atlocalRootwithout descending into subdirectories.voidsyncLocalTree(String localRoot, int mode)Synchronizes the remote tree rooted at the current remote directory into the local directory atlocalRoot.voidsyncRemoteTree(String localRoot, int mode)Synchronizes the local tree rooted atlocalRootinto the current remote directory.voidsyncRemoteTree2(String localDirPath, int mode, boolean bDescend, boolean bPreviewOnly)Provides the upload synchronization behavior and valid modes ofwith traversal and preview controls.syncRemoteTree(String, int)syst()SendsSYSTand returns the server's operating-system type reply.Methods inherited from class com.chilkatsoft.chilkat2.ChilkatObject
close, getDebugLogFilePath, getLastErrorHtml, getLastErrorText, getLastErrorXml, getLastMethodSuccess, getVerboseLogging, getVersion, isClosed, setDebugLogFilePath, setLastMethodSuccess, setVerboseLogging, toString
-
Constructor Details
-
Ftp2
public Ftp2()Creates a newFtp2object.
-
-
Method Details
-
getAbortCurrent
public boolean getAbortCurrent()Set totrueto 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
falseafter 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.
- Returns:
- the value of the
AbortCurrentproperty
-
setAbortCurrent
public void setAbortCurrent(boolean value)Sets theAbortCurrentproperty; seegetAbortCurrent().- Parameters:
value- the new value
-
getAccount
Very rarely needed today: Almost all modern FTP servers rely exclusively on theUSERandPASScommands for authentication and access control.The
ACCTcommand 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, makingACCTobsolete 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
ACCTcommand when a server requires an account in addition to the username and password.- Returns:
- the value of the
Accountproperty
-
setAccount
Sets theAccountproperty; seegetAccount().- Parameters:
value- the new value (notnull)
-
getActivePortRangeEnd
public int getActivePortRangeEnd()Specifies the last local TCP port that may be used for active-mode data connections. The default is0. Valid nonzero values are1through65535.The range beginning with
is inclusive. IfgetActivePortRangeStart()ActivePortRangeStartis0, this property is ignored and the operating system chooses an ephemeral listening port. If this value is0or is less thanActivePortRangeStart, Chilkat behaves as though both endpoints equalActivePortRangeStart.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
PORTandEPRTand may be changed while the control connection is already established.Active mode setting: This property is used only when
isgetPassive()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.- Returns:
- the value of the
ActivePortRangeEndproperty
-
setActivePortRangeEnd
public void setActivePortRangeEnd(int value)Sets theActivePortRangeEndproperty; seegetActivePortRangeEnd().- Parameters:
value- the new value
-
getActivePortRangeStart
public int getActivePortRangeStart()Specifies the first local TCP port that may be used for active-mode data connections. The default is0. Valid nonzero values are1through65535.When this property is
0,is ignored and Chilkat binds the listening socket to portgetActivePortRangeEnd()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 is0or 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
PORTandEPRToperation and may be changed after the FTP control connection has been established. Active mode setting: This property is used only whenisgetPassive()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.- Returns:
- the value of the
ActivePortRangeStartproperty
-
setActivePortRangeStart
public void setActivePortRangeStart(int value)Sets theActivePortRangeStartproperty; seegetActivePortRangeStart().- Parameters:
value- the new value
-
getAllocateSize
public long getAllocateSize()Rarely needed: The FTPALLOcommand 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 ignoreALLOor do not require it. Leave this property at its default value of0unless the server explicitly requires pre-allocation.Specifies the size, in bytes, to send in an
ALLOcommand before the next applicable upload. For example, a value of20sendsALLO 20. The default value of0disables the command.This is a one-shot setting. It is consumed by the next applicable upload and automatically reset to
0. It applies to normal, in-memory, text, and append uploads. A successful FTP reply indicating that allocation is unnecessary, such as reply code202, does not prevent the upload from continuing.- Returns:
- the value of the
AllocateSizeproperty
-
setAllocateSize
public void setAllocateSize(long value)Sets theAllocateSizeproperty; seegetAllocateSize().- Parameters:
value- the new value (0 .. 4294967295)
-
getAllowMlsd
public boolean getAllowMlsd()Controls whether machine-readable directory listings are requested withMLSDwhen the server advertises support. The default istrue.When this property is
trueandMLSDis advertised, Chilkat usesMLSD. Otherwise, a legacy listing is used:NLSTwhenisgetPreferNlst()true, orLISTwhen it isfalse.MLSDprovides standardized facts such as type, size, and modification time and is generally more reliable than parsing server-specificLISToutput. Facts not supplied by the server remain unavailable. When apermfact is present,returns it rather than a UNIX-style permission string.getPermissions(int)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.
- Returns:
- the value of the
AllowMlsdproperty
-
setAllowMlsd
public void setAllowMlsd(boolean value)Sets theAllowMlsdproperty; seegetAllowMlsd().- Parameters:
value- the new value
-
getAuthSsl
public boolean getAuthSsl()Legacy and very uncommon:AUTH SSLoriginated in early FTP security drafts from the era when SSL was the standard encryption protocol. For modern FTP servers, useinstead. Most security-conscious servers requiregetAuthTls()AUTH TLSand may rejectAUTH SSLto 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 supportAUTH TLS. Set totrueto use explicit FTP over TLS by sendingAUTH SSLon 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
USERandPASSare sent.performs the explicit TLS upgrade but does not log in. DuringconnectOnly(), Chilkat sendsconnect()PBSZandPROTas required by. If the server responds withgetDataProtection()530 Please login with USER and PASS, Chilkat logs in and automatically retries those commands.If the server accepts the
AUTHcommand but rejects a requiredPBSZorPROTcommand, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.AUTH SSLis the alternative explicit-TLS command used by this property. IfisgetSsl()true, implicit TLS takes priority. If both this property andaregetAuthTls()truewhileSslisfalse,AuthTlstakes priority and Chilkat sendsAUTH TLS.- Returns:
- the value of the
AuthSslproperty
-
setAuthSsl
public void setAuthSsl(boolean value)Sets theAuthSslproperty; seegetAuthSsl().- Parameters:
value- the new value
-
getAuthTls
public boolean getAuthTls()Set totrueto use explicit FTP over TLS by sendingAUTH TLSon the FTP control channel. The client first establishes a plain FTP control connection, receives the server greeting, and then upgrades that connection to TLS. Port21is conventionally used.The TLS upgrade is completed before
USERandPASSare sent.performs the explicit TLS upgrade but does not log in. DuringconnectOnly(), Chilkat sendsconnect()PBSZandPROTas required by. If the server responds withgetDataProtection()530 Please login with USER and PASS, Chilkat logs in and automatically retries those commands.If the server accepts the
AUTHcommand but rejects a requiredPBSZorPROTcommand, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.If
isgetSsl()true, implicit TLS takes priority and this property is ignored. If bothAuthTlsandaregetAuthSsl()truewhileSslisfalse,AuthTlstakes priority.AuthTls versus AuthSsl: Both properties select explicit FTPS. Their only difference is the command sent to initiate TLS:
AUTH TLSfor this property andAUTH SSLforAuthSsl.- Returns:
- the value of the
AuthTlsproperty
-
setAuthTls
public void setAuthTls(boolean value)Sets theAuthTlsproperty; seegetAuthTls().- Parameters:
value- the new value
-
getAutoFeat
public boolean getAutoFeat()Rarely changed: Leave this property at its default value oftruefor nearly all modern FTP servers. TheFEATcommand was standardized in RFC 2389 in 1998 and is broadly supported by mainstream FTP software, including FileZilla Server, vsftpd, ProFTPD, and IIS. Set it tofalseonly for a legacy or nonconforming server that mishandlesFEAT. Controls whether aFEATcommand is sent automatically after login. The default istrue. The response is processed to detect capabilities such asMLSD,UTF8,EPSV,MODE Z, and server-specific extensions.When
is alsogetAutoSyst()true, automaticSYSTis sent first. IfUTF8is advertised andisgetAutoOptsUtf8()true, capability processing is followed byOPTS UTF8 ON.The same capability processing can be performed later by calling
explicitly.feat()- Returns:
- the value of the
AutoFeatproperty
-
setAutoFeat
public void setAutoFeat(boolean value)Sets theAutoFeatproperty; seegetAutoFeat().- Parameters:
value- the new value
-
getAutoFix
public boolean getAutoFix()Controls automatic adjustment of,getSsl(), andgetAuthSsl()based solely ongetAuthTls(). The default isgetPort()true. The only recognized ports are21and990.Port Automatic adjustment
21SetstogetSsl()false.andgetAuthTls()continue to determine whether explicit TLS is requested.getAuthSsl()990SetstogetSsl()trueand setsandgetAuthTls()togetAuthSsl()false.Any other port Makes 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
21and990.- Returns:
- the value of the
AutoFixproperty
-
setAutoFix
public void setAutoFix(boolean value)Sets theAutoFixproperty; seegetAutoFix().- Parameters:
value- the new value
-
getAutoGetSizeForProgress
public boolean getAutoGetSizeForProgress()Controls whether Chilkat sends aSIZEcommand before a download so percentage-based progress can be calculated. The default isfalse. Each size query adds a control-channel round trip.A nonzero one-shot value in
orgetProgressMonSize()supplies the expected size directly and avoids this additional query. Even when this property isgetProgressMonSize64()false, percentage progress may be available if the server includes a usable size in its preliminary transfer reply.- Returns:
- the value of the
AutoGetSizeForProgressproperty
-
setAutoGetSizeForProgress
public void setAutoGetSizeForProgress(boolean value)Sets theAutoGetSizeForProgressproperty; seegetAutoGetSizeForProgress().- Parameters:
value- the new value
-
getAutoOptsUtf8
public boolean getAutoOptsUtf8()Controls whetherOPTS UTF8 ONis sent automatically when a processedFEATresponse advertisesUTF8. The default istrue. When UTF-8 is advertised, Chilkat setsandgetCommandCharset()togetDirListingCharset()utf-8, overwriting values previously assigned by the application.If
UTF8is not advertised, the existing charset property values are left unchanged. This behavior applies both during automatic capability discovery and whenis called explicitly.feat()Set to
falsefor a server that advertises UTF-8 but rejects the option or uses a different encoding in practice.- Returns:
- the value of the
AutoOptsUtf8property
-
setAutoOptsUtf8
public void setAutoOptsUtf8(boolean value)Sets theAutoOptsUtf8property; seegetAutoOptsUtf8().- Parameters:
value- the new value
-
getAutoSetUseEpsv
public boolean getAutoSetUseEpsv()Recommended setting: Applications should set this property totrue. The default isfalsein current versions, but will change totruein Chilkat v12.0.0.EPSVis preferred on modern networks because it supports both IPv4 and IPv6, whereasPASVcannot represent an IPv6 address. It is also more reliable through NAT and firewalls because theEPSVreply contains only a port number and relies on the address of the existing control connection. In contrast, aPASVreply 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
is recalculated when server capabilities are processed. The default isgetUseEpsv()false. Processing occurs during the initial connection whenisgetAutoFeat()true, or whenis called explicitly.feat()The result is based on both the advertised capabilities and the connection context; it is not simply a copy of whether
EPSVappears in theFEATreply. For example, an IPv4 connection may retainUseEpsv = FALSEeven when the server advertisesEPSV. Automatic recalculation can overwrite an explicitly assigned value, and each new connection recalculates it for the new session.If an attempted
EPSVcommand is rejected, Chilkat falls back toPASVfor that data connection. The failed attempt is not remembered as a session-wide reason to disable futureEPSVattempts.- Returns:
- the value of the
AutoSetUseEpsvproperty
-
setAutoSetUseEpsv
public void setAutoSetUseEpsv(boolean value)Sets theAutoSetUseEpsvproperty; seegetAutoSetUseEpsv().- Parameters:
value- the new value
-
getAutoSyst
public boolean getAutoSyst()Controls whether aSYSTcommand is sent automatically after login. The default istrue. The server's operating-system type can help Chilkat interpret legacyLISToutput and other server-specific behavior.When both this property and
aregetAutoFeat()true, automaticSYSToccurs before automaticFEAT.Set to
falseonly when a particular server rejects or mishandlesSYST.- Returns:
- the value of the
AutoSystproperty
-
setAutoSyst
public void setAutoSyst(boolean value)Sets theAutoSystproperty; seegetAutoSyst().- Parameters:
value- the new value
-
getAutoXcrc
public boolean getAutoXcrc()Controls automatic post-upload verification with the server-specificXCRCcommand. The default isfalse. When enabled and the server supportsXCRC, Chilkat requests a CRC after an upload and treats a mismatch as transfer failure.If
XCRCsupport 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 processedFEATresponse.Integrity scope: CRC verification can detect accidental corruption in transit or storage, but it is not a cryptographic authenticity check.
- Returns:
- the value of the
AutoXcrcproperty
-
setAutoXcrc
public void setAutoXcrc(boolean value)Sets theAutoXcrcproperty; seegetAutoXcrc().- Parameters:
value- the new value
-
getBandwidthThrottleDown
public int getBandwidthThrottleDown()Specifies the approximate maximum download rate in bytes per second. The default value of0disables 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.
- Returns:
- the value of the
BandwidthThrottleDownproperty
-
setBandwidthThrottleDown
public void setBandwidthThrottleDown(int value)Sets theBandwidthThrottleDownproperty; seegetBandwidthThrottleDown().- Parameters:
value- the new value
-
getBandwidthThrottleUp
public int getBandwidthThrottleUp()Specifies the approximate maximum upload rate in bytes per second. The default value of0disables throttling.The limit is averaged over the transfer. Very small uploads may complete before the configured rate can be closely approximated.
- Returns:
- the value of the
BandwidthThrottleUpproperty
-
setBandwidthThrottleUp
public void setBandwidthThrottleUp(int value)Sets theBandwidthThrottleUpproperty; seegetBandwidthThrottleUp().- Parameters:
value- the new value
-
getClientIpAddress
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.
- Returns:
- the value of the
ClientIpAddressproperty
-
setClientIpAddress
Sets theClientIpAddressproperty; seegetClientIpAddress().- Parameters:
value- the new value (notnull)
-
getCommandCharset
Specifies the character encoding used by high-level FTP operations for commands containing non-ASCII text, including remote paths and filenames. The default isANSI. Charset names and the keywordANSIare case-insensitive. An unrecognized charset name is clamped toutf-8, and the getter returnsutf-8. Usually changed automatically to UTF-8: Although the default value isANSI, when the server advertises UTF-8 andis enabled, Chilkat automatically changes this property togetAutoOptsUtf8()utf-8. Nearly all modern FTP servers support UTF-8, soutf-8is typically the effective value after connecting. If UTF-8 is not advertised, the existing value is left unchanged. WhatANSImeans: It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples includewindows-1252on Western-language Windows systems,windows-1251for Cyrillic,windows-1256for Arabic, andwindows-932(Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding isutf-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-8to 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.
- Returns:
- the value of the
CommandCharsetproperty
-
setCommandCharset
Sets theCommandCharsetproperty; seegetCommandCharset().- Parameters:
value- the new value (notnull)
-
getConnectFailReason
public int getConnectFailReason()Contains a numeric reason code afterorconnect()fails. Use this value for broad classification and inspectconnectOnly()LastErrorTextfor detailed diagnostics.Code Meaning
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.201TheAUTH TLSorAUTH SSLupgrade 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 to301whileremainsgetConnectVerified()true, because the TCP and FTP connection succeeded before the login was rejected.- Returns:
- the value of the
ConnectFailReasonproperty (read-only)
-
getConnectTimeout
public int getConnectTimeout()Specifies the maximum number of seconds to wait for a remote endpoint to accept a TCP connection. The default is30. A value of0or 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.
- Returns:
- the value of the
ConnectTimeoutproperty
-
setConnectTimeout
public void setConnectTimeout(int value)Sets theConnectTimeoutproperty; seegetConnectTimeout().- Parameters:
value- the new value
-
getConnectVerified
public boolean getConnectVerified()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.getLoginVerified()This is a verification result, not a current-socket-state property. It remains
trueafterif the preceding connection was successfully established.disconnect()- Returns:
- the value of the
ConnectVerifiedproperty (read-only)
-
getCrlfMode
public int getCrlfMode()Controls line-ending conversion when downloading in ASCII transfer mode. The default is0.Value Downloaded 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.
- Returns:
- the value of the
CrlfModeproperty
-
setCrlfMode
public void setCrlfMode(int value)Sets theCrlfModeproperty; seegetCrlfMode().- Parameters:
value- the new value
-
getCurBytesReceived
public long getCurBytesReceived()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.- Returns:
- the value of the
CurBytesReceivedproperty (read-only)
-
getCurBytesReceived64
public long getCurBytesReceived64()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.- Returns:
- the value of the
CurBytesReceived64property (read-only)
-
getCurBytesReceivedStr
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.- Returns:
- the value of the
CurBytesReceivedStrproperty (read-only)
-
getCurBytesSent
public long getCurBytesSent()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.- Returns:
- the value of the
CurBytesSentproperty (read-only)
-
getCurBytesSent64
public long getCurBytesSent64()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.- Returns:
- the value of the
CurBytesSent64property (read-only)
-
getCurBytesSentStr
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.- Returns:
- the value of the
CurBytesSentStrproperty (read-only)
-
getDataProtection
Specifies the protection level for FTP data connections. The value is compared case-insensitively. The default iscontrol.Value Behavior
controlData connections use the same protection state as the control connection. If the control connection is unencrypted, noPBSZorPROTcommands are sent.clearData connections are requested as unencrypted. If the control connection is also unencrypted, noPBSZorPROTcommands are sent. If the control connection uses TLS, Chilkat sendsPBSZ 0followed byPROT C. If the server rejectsPROT Cbut acceptsPROT P, Chilkat falls back to private data protection.privateData connections are protected with TLS. For an encrypted control connection, Chilkat sendsPBSZ 0followed byPROT P.sends the requiredconnect()PBSZandPROTcommands. If the server requires login first and replies with530 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.
- Returns:
- the value of the
DataProtectionproperty
-
setDataProtection
Sets theDataProtectionproperty; seegetDataProtection().- Parameters:
value- the new value (notnull)
-
getDirListingCharset
Specifies the character encoding used only to decode directory-listing and related server-response bytes. It applies to responses fromLIST,NLST, andMLSD. 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 keywordANSIare case-insensitive.ANSImeans the platform's system-default single-byte encoding or default system locale; on Windows, this is the active code page (ACP).What
ANSImeans: It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples includewindows-1252on Western-language Windows systems,windows-1251for Cyrillic,windows-1256for Arabic, andwindows-932(Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding isutf-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
is enabled and UTF-8 support is advertised, Chilkat changes this property togetAutoOptsUtf8()utf-8, even if the application previously assigned another value. If UTF-8 is not advertised, the existing value is left unchanged.- Returns:
- the value of the
DirListingCharsetproperty
-
setDirListingCharset
Sets theDirListingCharsetproperty; seegetDirListingCharset().- Parameters:
value- the new value (notnull)
-
getDownloadTransferRate
public int getDownloadTransferRate()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.- Returns:
- the value of the
DownloadTransferRateproperty (read-only)
-
getEnableSecrets
public boolean getEnableSecrets()Controls automatic resolution of credential values from secure operating-system storage. The default isfalse. 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
,getPassword(),getHttpProxyPassword(), andgetProxyPassword(). Chilkat resolves them through Windows Credential Manager on Windows or Apple Keychain on macOS.getSocksPassword()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.
- Returns:
- the value of the
EnableSecretsproperty
-
setEnableSecrets
public void setEnableSecrets(boolean value)Sets theEnableSecretsproperty; seegetEnableSecrets().- Parameters:
value- the new value
-
getForcePortIpAddress
Specifies the IPv4 address advertised to the server for active-mode data connections. This property affects bothPORTandEPRT. Supply a numeric IPv4 address, the keywordcontrol, or an IPv4 address prefixed withbind-. IPv6 values are not accepted. Keywords and prefixes are case-insensitive.controluses the local IPv4 address of the established FTP control socket.bind-192.0.2.10advertises the address and also binds the local data-listener socket to that address.- A plain IPv4 address changes the address sent in
PORTorEPRTwithout explicitly binding the listener to that address.
If
is set, this property should specify the same local address. When agetClientIpAddress()bind-value is used withandgetActivePortRangeStart(), Chilkat binds to the specified address while searching the effective range for an available port.getActivePortRangeEnd()Active mode setting: This property is used only when
isgetPassive()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.- Returns:
- the value of the
ForcePortIpAddressproperty
-
setForcePortIpAddress
Sets theForcePortIpAddressproperty; seegetForcePortIpAddress().- Parameters:
value- the new value (notnull)
-
getGreeting
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 code220and may include server identification or policy information.The value remains available after
.disconnect()- Returns:
- the value of the
Greetingproperty (read-only)
-
getHasModeZ
public boolean getHasModeZ()Indicates whether the FTP server advertised support forMODE Z, which compresses FTP data streams using the DEFLATE algorithm.This property becomes meaningful after Chilkat has processed a successful
FEATresponse, either automatically becauseisgetAutoFeat()trueor through an explicit call to. Before capability discovery, a value offeat()falsedoes not establish that the server lacksMODE Zsupport.Call
after connecting to enable or disable compressed transfer mode.setModeZ()- Returns:
- the value of the
HasModeZproperty (read-only)
-
getHeartbeatMs
public int getHeartbeatMs()Specifies the interval, in milliseconds, betweencallbacks during methods that support periodic cancellation checks. The default isAbortCheck0, which disables these callbacks.Smaller values can improve cancellation responsiveness but increase callback overhead. Methods that complete quickly may not generate a callback.
- Returns:
- the value of the
HeartbeatMsproperty
-
setHeartbeatMs
public void setHeartbeatMs(int value)Sets theHeartbeatMsproperty; seegetHeartbeatMs().- Parameters:
value- the new value
-
getHostname
Specifies the FTP server hostname or numeric IPv4/IPv6 address. Do not include a URL scheme, path, or port; configure the port separately withPort.- Returns:
- the value of the
Hostnameproperty
-
setHostname
Sets theHostnameproperty; seegetHostname().- Parameters:
value- the new value (notnull)
-
getHttpProxyAuthMethod
Specifies the authentication method used with an HTTP proxy. Supported values areBasicandNTLM. Leave empty when the proxy does not require authentication.- Returns:
- the value of the
HttpProxyAuthMethodproperty
-
setHttpProxyAuthMethod
Sets theHttpProxyAuthMethodproperty; seegetHttpProxyAuthMethod().- Parameters:
value- the new value (notnull)
-
getHttpProxyDomain
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.- Returns:
- the value of the
HttpProxyDomainproperty
-
setHttpProxyDomain
Sets theHttpProxyDomainproperty; seegetHttpProxyDomain().- Parameters:
value- the new value (notnull)
-
getHttpProxyHostname
Specifies the hostname or numeric IP address of an HTTP proxy used to establish the FTP control connection. Leave empty to connect directly.- Returns:
- the value of the
HttpProxyHostnameproperty
-
setHttpProxyHostname
Sets theHttpProxyHostnameproperty; seegetHttpProxyHostname().- Parameters:
value- the new value (notnull)
-
getHttpProxyPassword
Specifies the password used to authenticate to the HTTP proxy. It is used together withHttpProxyUsernameandHttpProxyAuthMethod.- Returns:
- the value of the
HttpProxyPasswordproperty
-
setHttpProxyPassword
Sets theHttpProxyPasswordproperty; seegetHttpProxyPassword().- Parameters:
value- the new value (notnull)
-
getHttpProxyPort
public int getHttpProxyPort()Specifies the TCP port of the HTTP proxy. Common values include8080and3128, but the correct value is determined by the proxy configuration.- Returns:
- the value of the
HttpProxyPortproperty
-
setHttpProxyPort
public void setHttpProxyPort(int value)Sets theHttpProxyPortproperty; seegetHttpProxyPort().- Parameters:
value- the new value
-
getHttpProxyUsername
Specifies the username used to authenticate to the HTTP proxy. Leave empty when the proxy allows unauthenticated connections.- Returns:
- the value of the
HttpProxyUsernameproperty
-
setHttpProxyUsername
Sets theHttpProxyUsernameproperty; seegetHttpProxyUsername().- Parameters:
value- the new value (notnull)
-
getIdleTimeoutMs
public int getIdleTimeoutMs()Specifies the maximum period, in milliseconds, during which no control-channel response or forward upload progress is observed. The default is60000. A value of0or 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.
- Returns:
- the value of the
IdleTimeoutMsproperty
-
setIdleTimeoutMs
public void setIdleTimeoutMs(int value)Sets theIdleTimeoutMsproperty; seegetIdleTimeoutMs().- Parameters:
value- the new value
-
getIsConnected
public boolean getIsConnected()Deprecated. Indicates whether the object appears to be connected and authenticated. Reading this property may sendNOOPto test the session. Useinstead.checkConnection()- Returns:
- the value of the
IsConnectedproperty (read-only)
-
getKeepSessionLog
public boolean getKeepSessionLog()Controls collection of an in-memory FTP protocol log. When enabled, commands and server replies are available in. UsegetSessionLog()to discard previously collected text.clearSessionLog()- Returns:
- the value of the
KeepSessionLogproperty
-
setKeepSessionLog
public void setKeepSessionLog(boolean value)Sets theKeepSessionLogproperty; seegetKeepSessionLog().- Parameters:
value- the new value
-
getLargeFileMeasures
public boolean getLargeFileMeasures()Controls an additional keepalive measure for very long uploads and downloads. The default isfalse. When enabled, Chilkat sendsNOOPon 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.
- Returns:
- the value of the
LargeFileMeasuresproperty
-
setLargeFileMeasures
public void setLargeFileMeasures(boolean value)Sets theLargeFileMeasuresproperty; seegetLargeFileMeasures().- Parameters:
value- the new value
-
getLastReply
Contains the most recent FTP control-channel reply, including its three-digit status code and message. Examples include250 Directory successfully changed.and550 Failed to change directory.The value is updated by successful as well as failed commands. After
, it normally contains the server's reply todisconnect()QUIT, such as221 Goodbye.. Some replies are multiline; use this property together with the method return value andLastErrorTextwhen diagnosing a failure.- Returns:
- the value of the
LastReplyproperty (read-only)
-
getListOption
Specifies an option string appended literally to the legacyLISTcommand, such as-a. For example, setting this property to-asendsLIST -a. Chilkat does not interpret the option locally. It has no effect whencausesgetAllowMlsd()MLSDto be used or whencausesgetPreferNlst()NLSTto be used.LISToptions and output formats are not standardized by FTP. Many UNIX-like servers pass the option to an underlyinglsimplementation, while other servers may reject or interpret it differently.- Returns:
- the value of the
ListOptionproperty
-
setListOption
Sets theListOptionproperty; seegetListOption().- Parameters:
value- the new value (notnull)
-
getListPattern
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(int),getIsDirectory(int), and the listing timestamp methods.getSize(int)Chilkat retrieves the full directory listing and applies this pattern locally; the pattern is not appended to
LIST,NLST, orMLSD. For example,*.txtalso matches a name such asUPPER.TXT.Specify only a name pattern, such as
*.txt. To listsubdir/*.txt, first callforchangeRemoteDir(String)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.
- Returns:
- the value of the
ListPatternproperty
-
setListPattern
Sets theListPatternproperty; seegetListPattern().- Parameters:
value- the new value (notnull)
-
getLoginVerified
public boolean getLoginVerified()Indicates whether FTP authentication succeeded during the most recent login attempt. A TCP connection may be established even when this property isfalse; for example, rejected credentials leavegetConnectVerified()trueand this propertyfalse.This is a verification result, not a current-socket-state property. It remains
trueafterif the preceding session was successfully authenticated.disconnect()- Returns:
- the value of the
LoginVerifiedproperty (read-only)
-
getPartialTransfer
public boolean getPartialTransfer()Indicates whether the most recent download method received some, but not all, of the remote file. It isfalsewhen 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.
- Returns:
- the value of the
PartialTransferproperty (read-only)
-
getPassive
public boolean getPassive()Selects the FTP data-connection mode. The default istruefor passive mode. Set tofalsefor active mode.Mode Connection direction
Passive The server listens and the client connects to the server for each data transfer.
Active The 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.
- Returns:
- the value of the
Passiveproperty
-
setPassive
public void setPassive(boolean value)Sets thePassiveproperty; seegetPassive().- Parameters:
value- the new value
-
getPassiveUseHostAddr
public boolean getPassiveUseHostAddr()Controls how the address returned byPASVis handled. The default istrue. When enabled, Chilkat ignores the IP address embedded in the server'sPASVreply 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.
- Returns:
- the value of the
PassiveUseHostAddrproperty
-
setPassiveUseHostAddr
public void setPassiveUseHostAddr(boolean value)Sets thePassiveUseHostAddrproperty; seegetPassiveUseHostAddr().- Parameters:
value- the new value
-
getPassword
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 aSecureStringshould useinstead.setSecurePassword(SecureString)- Returns:
- the value of the
Passwordproperty
-
setPassword
Sets thePasswordproperty; seegetPassword().- Parameters:
value- the new value (notnull)
-
getPercentDoneScale
public int getPercentDoneScale()Specifies the integer value that represents 100 percent inPercentDonecallbacks. The default is100. For example, a scale of1000allows one-tenth-percent resolution, where callback value453represents 45.3 percent.The value is limited to the range
10through100000. This property is relevant only in environments that support event callbacks and only for operations whose total work can be measured.- Returns:
- the value of the
PercentDoneScaleproperty
-
setPercentDoneScale
public void setPercentDoneScale(int value)Sets thePercentDoneScaleproperty; seegetPercentDoneScale().- Parameters:
value- the new value
-
getPort
public int getPort()Specifies the FTP server port. Port21is conventionally used for plain FTP or explicit FTPS, and port990is conventionally used for implicit FTPS.When
isgetAutoFix()true, only these two port numbers cause automatic changes to,getSsl(), andgetAuthSsl(). A custom port leaves all three TLS-mode properties unchanged.getAuthTls()- Returns:
- the value of the
Portproperty
-
setPort
public void setPort(int value)Sets thePortproperty; seegetPort().- Parameters:
value- the new value
-
getPreferIpv6
public boolean getPreferIpv6()Controls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses. The default isfalse, which prefers IPv4. Set it totrueto prefer IPv6.- Returns:
- the value of the
PreferIpv6property
-
setPreferIpv6
public void setPreferIpv6(boolean value)Sets thePreferIpv6property; seegetPreferIpv6().- Parameters:
value- the new value
-
getPreferNlst
public boolean getPreferNlst()Controls whetherNLSTis preferred overLISTwhen a legacy directory listing is required. The default isfalse. This property is consulted only whendoes not result ingetAllowMlsd()MLSDbeing used.NLSTgenerally returns names only. Do not rely on indexed sizes, timestamps, ownership, group, or permission information after anNLSTlisting. BecauseNLSTdoes 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
enabled whenever possible because MLSD is the standardized machine-readable listing command.getAllowMlsd()- Returns:
- the value of the
PreferNlstproperty
-
setPreferNlst
public void setPreferNlst(boolean value)Sets thePreferNlstproperty; seegetPreferNlst().- Parameters:
value- the new value
-
getProgressMonSize
public int getProgressMonSize()Specifies the expected size, in bytes, of the next file downloaded bywhen the size is not otherwise known. Chilkat uses the value to calculate percentage progress.getFile(String, String)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.getAutoGetSizeForProgress()If this property is zero, percentage progress may still be available when the server's preliminary transfer reply includes the file size.
- Returns:
- the value of the
ProgressMonSizeproperty
-
setProgressMonSize
public void setProgressMonSize(int value)Sets theProgressMonSizeproperty; seegetProgressMonSize().- Parameters:
value- the new value
-
getProgressMonSize64
public long getProgressMonSize64()The 64-bit form of. 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 togetProgressMonSize()0.- Returns:
- the value of the
ProgressMonSize64property
-
setProgressMonSize64
public void setProgressMonSize64(long value)Sets theProgressMonSize64property; seegetProgressMonSize64().- Parameters:
value- the new value
-
getProxyHostname
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 byProxyMethod.- Returns:
- the value of the
ProxyHostnameproperty
-
setProxyHostname
Sets theProxyHostnameproperty; seegetProxyHostname().- Parameters:
value- the new value (notnull)
-
getProxyMethod
public int getProxyMethod()Selects the login sequence required by a traditional FTP proxy or firewall. The default is0, meaning no FTP proxy. Configure,getProxyHostname(), and the required proxy credentials before connecting.getProxyPort()Value Sequence sent
1— SITEUSER ProxyUsername PASS ProxyPassword SITE Hostname USER Username PASS Password
2— USER user@siteUSER Username@Hostname:Port PASS Password
3— USER with proxy loginUSER ProxyUsername PASS ProxyPassword USER Username@Hostname:Port PASS Password
4— USER/PASS/ACCTUSER Username@Hostname:Port ProxyUsername PASS Password ACCT ProxyPassword
5— OPENUSER ProxyUsername PASS ProxyPassword OPEN Hostname USER Username PASS Password
6— firewall IDUSER ProxyUsername@Hostname USER Username PASS Password
7USER ProxyUsername USER ProxyPassword SITE Hostname:Port USER Username PASS Password
8USER Username@ProxyUsername@Hostname PASS Password@ProxyPassword
9ProxyUsername 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.
- Returns:
- the value of the
ProxyMethodproperty
-
setProxyMethod
public void setProxyMethod(int value)Sets theProxyMethodproperty; seegetProxyMethod().- Parameters:
value- the new value
-
getProxyPassword
Specifies the password used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends onProxyMethod.- Returns:
- the value of the
ProxyPasswordproperty
-
setProxyPassword
Sets theProxyPasswordproperty; seegetProxyPassword().- Parameters:
value- the new value (notnull)
-
getProxyPort
public int getProxyPort()Specifies the TCP port on which the traditional FTP proxy or firewall accepts connections.- Returns:
- the value of the
ProxyPortproperty
-
setProxyPort
public void setProxyPort(int value)Sets theProxyPortproperty; seegetProxyPort().- Parameters:
value- the new value
-
getProxyUsername
Specifies the username used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends onProxyMethod.- Returns:
- the value of the
ProxyUsernameproperty
-
setProxyUsername
Sets theProxyUsernameproperty; seegetProxyUsername().- Parameters:
value- the new value (notnull)
-
getReadTimeout
public int getReadTimeout()Specifies the maximum number of seconds that a data connection may remain without receiving another byte. The default is60. A value of0or 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.
- Returns:
- the value of the
ReadTimeoutproperty
-
setReadTimeout
public void setReadTimeout(int value)Sets theReadTimeoutproperty; seegetReadTimeout().- Parameters:
value- the new value
-
getRequireSslCertVerify
public boolean getRequireSslCertVerify()Controls verification of the FTP server's TLS certificate chain.Value Behavior
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.supplements rather than replaces normal certificate verification.getTlsPinSet()The hostname used for the TLS connection is also used for Server Name Indication (SNI) and certificate hostname comparison.
- Returns:
- the value of the
RequireSslCertVerifyproperty
-
setRequireSslCertVerify
public void setRequireSslCertVerify(boolean value)Sets theRequireSslCertVerifyproperty; seegetRequireSslCertVerify().- Parameters:
value- the new value
-
getRestartNext
public boolean getRestartNext()Set totrueto 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 tofalse.For a resumed upload, Chilkat obtains the existing remote size, begins reading the local content at that offset, and appends the remaining bytes. For a resumed download, Chilkat uses the existing destination length as the
RESToffset and appends the remaining remote bytes.The setting applies to the ordinary file,
BinData, andStringBuilderupload and download methods, including,putFile(String, String),putFileBd(BinData, String),putFileSb(StringBuilder, String, boolean, String),getFile(String, String), andgetFileBd(String, BinData).getFileSb(String, String, StringBuilder)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.
- Returns:
- the value of the
RestartNextproperty
-
setRestartNext
public void setRestartNext(boolean value)Sets theRestartNextproperty; seegetRestartNext().- Parameters:
value- the new value
-
getSessionLog
Contains the in-memory FTP session log collected whileisgetKeepSessionLog()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.- Returns:
- the value of the
SessionLogproperty (read-only)
-
getSoRcvBuf
public int getSoRcvBuf()Specifies the socket receive-buffer size. The default is4194304bytes. 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.- Returns:
- the value of the
SoRcvBufproperty
-
setSoRcvBuf
public void setSoRcvBuf(int value)Sets theSoRcvBufproperty; seegetSoRcvBuf().- Parameters:
value- the new value
-
getSoSndBuf
public int getSoSndBuf()Specifies the socket send-buffer size. The default is262144bytes. Normally this property should remain unchanged.When upload throughput is unexpectedly low, testing values such as
524288or1048576may help. Values should generally be multiples of4096.- Returns:
- the value of the
SoSndBufproperty
-
setSoSndBuf
public void setSoSndBuf(int value)Sets theSoSndBufproperty; seegetSoSndBuf().- Parameters:
value- the new value
-
getSocksHostname
Specifies the hostname or IP address of the SOCKS proxy. It is used only whenisgetSocksVersion()4or5.- Returns:
- the value of the
SocksHostnameproperty
-
setSocksHostname
Sets theSocksHostnameproperty; seegetSocksHostname().- Parameters:
value- the new value (notnull)
-
getSocksPassword
Specifies the password for SOCKS5 username/password authentication. It is ignored for SOCKS4, which has no password-authentication field.- Returns:
- the value of the
SocksPasswordproperty
-
setSocksPassword
Sets theSocksPasswordproperty; seegetSocksPassword().- Parameters:
value- the new value (notnull)
-
getSocksPort
public int getSocksPort()Specifies the SOCKS proxy port. The default is1080. It is used only whenisgetSocksVersion()4or5.- Returns:
- the value of the
SocksPortproperty
-
setSocksPort
public void setSocksPort(int value)Sets theSocksPortproperty; seegetSocksPort().- Parameters:
value- the new value
-
getSocksUsername
Specifies the SOCKS user identifier. SOCKS5 may use it with password authentication; SOCKS4 sends it as the protocol user ID. It is used only whenisgetSocksVersion()4or5.- Returns:
- the value of the
SocksUsernameproperty
-
setSocksUsername
Sets theSocksUsernameproperty; seegetSocksUsername().- Parameters:
value- the new value (notnull)
-
getSocksVersion
public int getSocksVersion()Selects SOCKS proxy usage.Value Behavior
0Default. Connect directly without a SOCKS proxy.4Connect through a SOCKS4 proxy.5Connect through a SOCKS5 proxy.- Returns:
- the value of the
SocksVersionproperty
-
setSocksVersion
public void setSocksVersion(int value)Sets theSocksVersionproperty; seegetSocksVersion().- Parameters:
value- the new value
-
getSsl
public boolean getSsl()Set totrueto use implicit FTP over TLS. TLS begins immediately after the TCP connection is established, before the FTP greeting is received. Port990is conventionally used for implicit FTPS.This property has priority over
andgetAuthTls(). IfgetAuthSsl()Sslistrue, implicit TLS is used even when either explicit-TLS property is alsotrue.performs the implicit TLS handshake but does not sendconnectOnly()USERorPASS.TLS-mode precedence:
Sslhas highest priority. When it isfalse,AuthTlstakes priority overAuthSsl. When all three properties arefalse, plain FTP is used. Protocol distinction: FTPS is FTP protected by TLS. SFTP is a different protocol carried by SSH and is implemented by theSFtpclass.- Returns:
- the value of the
Sslproperty
-
setSsl
public void setSsl(boolean value)Sets theSslproperty; seegetSsl().- Parameters:
value- the new value
-
getSslAllowedCiphers
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:
rsa1024orrsa2048to require a minimum RSA server-key size.secure-renegotiationto require secure TLS renegotiation.best-practicesto use the security policy recommended by the installed Chilkat version.
Legacy keywords such as
aes256-cbc,aes128-cbc,3des-cbc, andrc4remain recognized for compatibility, but explicitly listing acceptable suites is preferred.- Returns:
- the value of the
SslAllowedCiphersproperty
-
setSslAllowedCiphers
Sets theSslAllowedCiphersproperty; seegetSslAllowedCiphers().- Parameters:
value- the new value (notnull)
-
getSslProtocol
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.- Returns:
- the value of the
SslProtocolproperty
-
setSslProtocol
Sets theSslProtocolproperty; seegetSslProtocol().- Parameters:
value- the new value (notnull)
-
getSslServerCertVerified
public boolean getSslServerCertVerified()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
pinning is required and the check fails, the TLS connection itself fails.getTlsPinSet()- Returns:
- the value of the
SslServerCertVerifiedproperty (read-only)
-
getSyncCreateAllLocalDirs
public boolean getSyncCreateAllLocalDirs()Controls whether download synchronization creates empty remote directories on the local filesystem. The default istrue. Whenfalse, a local directory is created only when it is needed to contain a downloaded file.- Returns:
- the value of the
SyncCreateAllLocalDirsproperty
-
setSyncCreateAllLocalDirs
public void setSyncCreateAllLocalDirs(boolean value)Sets theSyncCreateAllLocalDirsproperty; seegetSyncCreateAllLocalDirs().- Parameters:
value- the new value
-
getSyncMustMatch
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. Matching is performed against the file's basename, not its relative path. Thus
keep.txtcan match a file in any traversed subdirectory, while a pattern such assubdir/*.txtdoes not match a nested relative path.This filter applies to synchronization methods and also to
,putTree(String), anddownloadTree(String).dirTreeXml()- Returns:
- the value of the
SyncMustMatchproperty
-
setSyncMustMatch
Sets theSyncMustMatchproperty; seegetSyncMustMatch().- Parameters:
value- the new value (notnull)
-
getSyncMustMatchDir
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.- Returns:
- the value of the
SyncMustMatchDirproperty
-
setSyncMustMatchDir
Sets theSyncMustMatchDirproperty; seegetSyncMustMatchDir().- Parameters:
value- the new value (notnull)
-
getSyncMustNotMatch
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;~*.Matching is performed against the file's basename, not its relative path. Exclusion is applied in addition to
.getSyncMustMatch()This filter also applies to
,putTree(String), anddownloadTree(String).dirTreeXml()- Returns:
- the value of the
SyncMustNotMatchproperty
-
setSyncMustNotMatch
Sets theSyncMustNotMatchproperty; seegetSyncMustNotMatch().- Parameters:
value- the new value (notnull)
-
getSyncMustNotMatchDir
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 toSyncMustMatchDir.- Returns:
- the value of the
SyncMustNotMatchDirproperty
-
setSyncMustNotMatchDir
Sets theSyncMustNotMatchDirproperty; seegetSyncMustNotMatchDir().- Parameters:
value- the new value (notnull)
-
getSyncPreview
Contains the preview produced bywhen ARG4 issyncRemoteTree2(String, int, boolean, boolean)true. Each CRLF-delimited line is an absolute local path that would be uploaded if preview mode were disabled.The value is replaced at the start of each preview operation. It is empty when no files qualify, when the preview fails, or when ARG2 is not a valid synchronization mode. A subsequent non-preview synchronization operation also clears it. Unrelated methods do not clear the most recent preview.
- Returns:
- the value of the
SyncPreviewproperty (read-only)
-
getTlsCipherSuite
Contains the cipher suite negotiated for the current or most recent successful TLS connection, such asTLS_AES_256_GCM_SHA384. It is empty before a TLS session has been established or after a failed attempt that produced no negotiated suite.- Returns:
- the value of the
TlsCipherSuiteproperty (read-only)
-
getTlsPinSet
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
isgetRequireSslCertVerify()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, andripemd320. Supported encodings includebase64,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.
- Returns:
- the value of the
TlsPinSetproperty
-
setTlsPinSet
Sets theTlsPinSetproperty; seegetTlsPinSet().- Parameters:
value- the new value (notnull)
-
getTlsVersion
Contains the protocol version negotiated for the current or most recent successful TLS connection, such asTLS 1.2orTLS 1.3. It is empty when no TLS session has been established.- Returns:
- the value of the
TlsVersionproperty (read-only)
-
getUncommonOptions
Provides a comma-separated list of compatibility options for uncommon platform or server requirements. The default is empty and should normally remain empty.Keyword Effect
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.
- Returns:
- the value of the
UncommonOptionsproperty
-
setUncommonOptions
Sets theUncommonOptionsproperty; seegetUncommonOptions().- Parameters:
value- the new value (notnull)
-
getUploadTransferRate
public int getUploadTransferRate()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.- Returns:
- the value of the
UploadTransferRateproperty (read-only)
-
getUseEpsv
public boolean getUseEpsv()Controls whether passive data connections first useEPSVinstead ofPASV. The default isfalse. This property has no effect whenisgetPassive()false.If
EPSVis rejected, Chilkat automatically retries the data connection usingPASV. The rejection does not disableEPSVfor the remainder of the session, so a later passive data connection may tryEPSVagain.can change this property automatically when server capabilities are examined.getAutoSetUseEpsv()Compatibility:
EPSVavoids embedding an IP address in the server reply and is the passive-mode command defined for IPv6. Some legacy FTP-aware firewalls mishandle it.- Returns:
- the value of the
UseEpsvproperty
-
setUseEpsv
public void setUseEpsv(boolean value)Sets theUseEpsvproperty; seegetUseEpsv().- Parameters:
value- the new value
-
getUsername
Specifies the FTP login name. The default isanonymous. Set it to an empty string to haveestablish the connection without performing authentication; authentication may then be handled separately withconnect().loginAfterConnectOnly()- Returns:
- the value of the
Usernameproperty
-
setUsername
Sets theUsernameproperty; seegetUsername().- Parameters:
value- the new value (notnull)
-
appendFile
Appends the contents of the local file atlocalFilePathto the remote file atremoteFilePath. Both arguments are paths in their respective local and remote filesystems.Uses the FTP
APPEcommand. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.- Parameters:
localFilePath- thelocalFilePathargument (notnull)remoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
appendFileBd
Appends the bytes in theBinDataobjectbdto the remote file atremoteFilename. No text encoding or line-ending conversion is performed.Uses the FTP
APPEcommand. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.- Parameters:
remoteFilename- theremoteFilenameargument (notnull)bd- thebdargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
appendFileFromTextData
Encodes the text intextDatausing the character encoding named bycharsetand appends the resulting bytes to the remote file atremoteFilename.This method controls the encoding of the file content. The encoding used for the remote filename itself is controlled separately by
.getCommandCharset()Uses the FTP
APPEcommand. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.- Parameters:
remoteFilename- theremoteFilenameargument (notnull)textData- thetextDataargument (notnull)charset- thecharsetargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
appendFileSb
Encodes the text in theStringBuildersbusing the charset named bycharsetand appends the resulting bytes to the remote file atremoteFilename.Uses the FTP
APPEcommand. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.- Parameters:
remoteFilename- theremoteFilenameargument (notnull)sb- thesbargument (notnull)charset- thecharsetargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
changeRemoteDir
Changes the current working directory on the FTP server toremoteDirPath. A relative path is resolved from the current remote directory; an absolute path is interpreted according to the server's path syntax.Chilkat sends one
CWDcommand containingremoteDirPath. It does not split a multi-level path into separate directory changes. A server may accept a path such asa/b/cin one command or may require the application to change one level at a time.If the
CWDcommand fails, the current remote directory remains unchanged.Current directory: Many Ftp2 methods operate relative to the current remote directory. Use
to inspect it.getCurrentRemoteDir()- Parameters:
remoteDirPath- theremoteDirPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
checkConnection
public boolean checkConnection()Returns whether Chilkat currently considers the FTP control connection to be open. It does not require that the session be authenticated: it can returntrueafterand beforeconnectOnly().loginAfterConnectOnly()This is a local connection-state check. It does not send
NOOP, reconnect automatically, or prove that a silently broken network path will carry the next command.- Returns:
- the result; this method never throws
ChilkatException
-
clearControlChannel
public void clearControlChannel()Requests that an explicit-FTPS control connection return to clear text after authentication. Data connections may remain protected according to. 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.getDataProtection()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
clearDirCache
public void clearDirCache()Clears the cached listing for the current remote directory. The next call toor another indexed listing method retrieves a fresh listing from the server.getDirCount()The cache is automatically invalidated when the current remote directory or
changes. Uploading, deleting, renaming, creating, or removing a remote item does not automatically refresh the cache. ChanginggetListPattern(),getAllowMlsd(),getPreferNlst(), orgetListOption()also leaves the existing cache intact.getDirListingCharset()After a remote change: Call this method before relying on indexed listing methods when the application has uploaded, renamed, deleted, created, or removed an item in the current remote directory.
-
clearSessionLog
public void clearSessionLog()Clears the in-memory FTP protocol log collected whileis enabled.getKeepSessionLog() -
connect
public void connect()Connects to the server specified byandgetHostname(), negotiates any configured proxy and TLS layer, receives the FTP greeting, and authenticates usinggetPort(),getUsername(), andgetPassword().getAccount()For implicit or explicit FTPS, TLS is established before
USERandPASSare sent. Chilkat sendsPBSZ 0and thePROTcommand required by. If the server requires login before accepting those protection commands, Chilkat authenticates and retries them. Rejection of a required protection command causes the connection attempt to fail.getDataProtection()After login, Chilkat sets binary transfer mode with
TYPE I, requestsSYST, sendsFEATwhenis enabled, and may sendgetAutoFeat()OPTS UTF8 ONwhen UTF-8 support is advertised andis enabled. It also obtains the initial current remote directory.getAutoOptsUtf8()Calling this method while already connected establishes a new FTP session and replaces the previous session state. The current remote directory, capability state, and listing cache are initialized for the new login.
A failed connection attempt does not leave an underlying plain FTP connection open. To separate connection establishment from authentication, call
followed byconnectOnly().loginAfterConnectOnly()Failure diagnosis: After failure, inspect
,getConnectFailReason(), 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.getLastReply()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
connectOnly
public void connectOnly()Establishes the configured proxy and TCP connection, performs any configured implicit or explicit TLS setup, and receives the FTP server greeting, but does not sendUSERorPASS. 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 TLSorAUTH SSL, and then performs the TLS handshake. When the control channel is protected, Chilkat also sendsPBSZ 0and thePROTcommand required by, even though login has not yet occurred.getDataProtection()After success,
isgetConnectVerified()trueandremainsgetLoginVerified()false. The current remote directory may be unavailable until login because many servers rejectPWDbefore authentication.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
convertToTls
public void convertToTls()Upgrades an already-connected clear FTP control channel to explicit TLS. This method is intended for a manually staged connection created withwhileconnectOnly(),getSsl(), andgetAuthTls()were disabled.getAuthSsl()Chilkat sends
AUTH TLS, performs the TLS handshake, sendsPBSZ 0, and then sends thePROTcommand required by. The method does not authenticate; callgetDataProtection()afterward.loginAfterConnectOnly()Do not call it when explicit or implicit FTPS was already enabled before connecting.
- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
createPlan
Creates and returns a textual upload plan for the local directory atlocalDir. The object must be connected because the plan records the current absolute remote directory together with the local source paths.The generated plan contains absolute local paths and absolute remote directory operations. Treat the text as a Chilkat-generated plan for
rather than as a portable or stable interchange format.putPlan(String, String)The plan records what to do, not a snapshot of file contents. If a local file changes before
PutPlanexecutes, the current file contents are uploaded.Resumable bulk upload:
PutPlanrecords completed operations in a log file. Reusing the plan and log after interruption allows already completed steps to be skipped.- Parameters:
localDir- thelocalDirargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
createRemoteDir
Creates the remote directory atremoteDirPathby sending oneMKDcommand. The path is interpreted relative to the current remote directory unless the server recognizes it as absolute.Chilkat does not split a multi-level path and does not issue separate commands to create missing parent directories. Some servers create all levels from one
MKD a/b/ccommand, while others require the parent directories to exist.If the directory already exists, the server commonly returns an error. A successful call does not refresh the cached indexed listing; call
when a fresh listing is required.clearDirCache()- Parameters:
remoteDirPath- theremoteDirPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
deleteMatching
Deletes files in the current remote directory whose names match the wildcard pattern inremotePattern. The method returns the number deleted, or-1if the operation fails.Chilkat sends a server-side legacy listing request such as
LIST *.txt, parses the returned entries, and sendsDELEfor matching files. Matching case sensitivity and wildcard behavior therefore depend on the server. Matching directories are not removed by this method.- Parameters:
remotePattern- theremotePatternargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
deleteRemoteFile
Deletes the remote file atremoteFilePath. The path may be relative to the current remote directory or absolute according to the server's path syntax.A successful deletion does not refresh the cached indexed listing. Call
when a fresh listing is required.clearDirCache()- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
deleteTree
public void deleteTree()Recursively deletes the files and subdirectories beneath the current remote directory. Child directories are removed after their contents are deleted, but the current root directory itself remains in place and remains the current remote directory. 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.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
dirTreeXml
Returns an XML representation of the complete remote directory tree rooted at the current remote directory. The result uses a<dirTree>root, nested<dir name="...">elements, and file elements containing the name, size, and available modification time.<dirTree> <file sz="123" dt="Mon, 27 Jul 2026 06:55:00 -0500">root.txt</file> <dir name="subdir"> <file sz="456" dt="...">nested.txt</file> </dir> </dirTree>Chilkat traverses by listing each directory and temporarily changing the server's current directory. Empty directories are included, and the original current remote directory is restored after successful traversal.
Traversal is affected by
,getSyncMustMatch(),getSyncMustNotMatch(), andgetSyncMustMatchDir(). This method retrieves metadata; it does not download file content.getSyncMustNotMatchDir()- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
disconnect
public void disconnect()Ends the FTP session and closes the control connection. When connected, Chilkat sendsQUITwhen possible and then closes the socket.The method is idempotent. Calling it before a connection exists or calling it again after the session is already closed succeeds without sending another FTP command. Historical properties such as
,getConnectVerified(),getLoginVerified(), andgetGreeting()may retain information from the completed session; usegetLastReply()for current connection state.checkConnection()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
downloadTree
Downloads all selected files and subdirectories beneath the current remote directory and recreates the tree under the local directory atlocalRoot. Existing local files are overwritten, and eligible empty remote directories are created locally.The file and directory filters in
,getSyncMustMatch(),getSyncMustNotMatch(), andgetSyncMustMatchDir()apply. UsegetSyncMustNotMatchDir()to exclude files older than a chosen date.setOldestDateStr(String)Windows filenames: Remote names that contain characters invalid in a Windows filename are sanitized when creating the local tree. Invalid characters are replaced with underscores and trailing periods are removed. For example,
a<b>c:d|e?f*g.txtis saved asa_b_c_d_e_f_g.txt. Different remote names can potentially map to the same local path.- Parameters:
localRoot- thelocalRootargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
feat
SendsFEATand returns the server's multiline capability reply. A server may return an error when the command is unsupported or not permitted in the current session state.A successful explicit call performs the same capability processing as automatic
FEAT. It can update, listing-extension detection, UTF-8 handling throughgetHasModeZ(), andgetAutoOptsUtf8()throughgetUseEpsv(), even whengetAutoSetUseEpsv()isgetAutoFeat()false.Some servers permit
FEATbefore authentication and others do not.- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getCreateTimeByNameStr
Returns the creation time for the file or directory named byfilenamein the current remote directory as an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.filenamemust be a name, not a path. Set the current remote directory first, and ensurematches the name so the item is present in the cached listing.getListPattern()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.
- Parameters:
filename- thefilenameargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getCreateTimeStr
Returns the creation time for cached directory-listing entryindexas an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.indexis a zero-based index from0through one less than. Creation-time availability depends on the server and listing format.getDirCount()An invalid index or unavailable creation time is a method failure and sets
LastMethodSuccesstofalse.- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getCurrentRemoteDir
Returns the current working directory reported by the FTP server, normally by using thePWDcommand.- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getDirCount
public int getDirCount()Returns the number of files and directories in the cached listing of the current remote directory after applying the case-insensitive. 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. ReturnsgetListPattern()-1if the listing cannot be obtained or parsed.The cache is not automatically refreshed by uploads, deletions, renames, directory creation/removal, raw commands, or changes to the listing-command selection properties. Call
when the server contents or desired listing format may have changed.clearDirCache()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.
- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getFile
Downloads the remote file atremoteFilePathto the local filesystem path atlocalFilePath. The local parent directory must already exist; this method does not create missing local directories.When not resuming, the downloaded file replaces an existing destination after the server accepts the transfer. If the server rejects the request before transfer begins, such as when the remote file does not exist, an existing destination file is preserved.
Use
immediately before this call to resume from the existing local file length.getRestartNext()controls data-channel inactivity. If a transfer fails after receiving some data, inspectgetReadTimeout(); completed bytes are not rolled back.getPartialTransfer()- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)localFilePath- thelocalFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileBd
Downloads the remote file atremoteFilePathand appends its bytes to the existing contents of theBinDataobject inbinData. The object is not cleared automatically. No text decoding or line-ending conversion is performed.When
isgetRestartNext()true, the current byte count inbinDatais used as the resume offset and only the remaining remote bytes are appended.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)binData- thebinDataargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileSb
Downloads the remote file atremoteFilePath, decodes its bytes using the charset named bycharset, and appends the resulting text to the existing contents of theStringBuilderinsb. The destination is not cleared automatically.A byte-order mark for the selected encoding is recognized and removed from the decoded text. Invalid byte sequences are replaced during decoding rather than causing the transfer itself to fail.
When
isgetRestartNext()true, the existing destination content is used to determine the resume offset, and the remaining decoded content is appended.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)charset- thecharsetargument (notnull)sb- thesbargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFileToStream
Downloads the remote file atremoteFilePathand writes its bytes to theStreamintoStream.For a synchronous call,
toStreammust 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.- Parameters:
remoteFilePath- theremoteFilePathargument (notnull)toStream- thetoStreamargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getFilename
Returns the name of cached directory-listing entryindex.indexis a zero-based index from0through one less than. The returned value is the name from the listing, not necessarily a full remote path.getDirCount()An out-of-range or negative index is a method failure and sets
LastMethodSuccesstofalse.- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getGroup
Returns the group name or identifier for cached directory-listing entryindex. 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, disablingmay expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.getAllowMlsd()- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getIsDirectory
public boolean getIsDirectory(int index)Returnstruewhen cached directory-listing entryindexis identified as a directory.indexis a zero-based index into the current cached listing.For an invalid index the method returns
falseand setsLastMethodSuccesstofalse. Check that property whenfalsemust be distinguished from a valid non-directory entry.- Parameters:
index- theindexargument- Returns:
- the result; this method never throws
ChilkatException
-
getIsSymbolicLink
public boolean getIsSymbolicLink(int index)Returnstruewhen cached directory-listing entryindexis identified as a symbolic link. This information is available only when the server's listing format reports it.For an invalid index the method returns
falseand setsLastMethodSuccesstofalse. A validfalseresult can also mean the entry is not a link or the listing did not provide link metadata.- Parameters:
index- theindexargument- Returns:
- the result; this method never throws
ChilkatException
-
getLastJsonData
Copies structured supplemental JSON produced by the immediately preceding method into theJsonObjectinjson. TLS connection and protected data-connection operations can populate information such as the negotiated TLS version.The data is transient. A later method may replace it or clear it to an empty object, including ordinary commands such as
NOOP, raw commands, or. Call this method immediately after the operation whose details are needed.disconnect()- Parameters:
json- thejsonargument (notnull)
-
getLastModifiedTimeByNameStr
Returns the last-modified time for the item named byfilenamein the current remote directory as an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.filenamemust be a name, not a path. Set the current remote directory first, and ensurematches the name.getListPattern()- Parameters:
filename- thefilenameargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getLastModifiedTimeStr
Returns the last-modified time for cached directory-listing entryindexas an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.indexis a zero-based index into the current cached listing.An invalid index or unavailable timestamp is a method failure and sets
LastMethodSuccesstofalse.- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getOwner
Returns the owner name or identifier for cached directory-listing entryindex. The value is empty when a valid entry has no owner metadata. An invalid index is a method failure and setsLastMethodSuccesstofalse. MLSD metadata: MLSD commonly provides accurate size and time facts but often omits owner and group. On a UNIX-like server, disablingmay expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.getAllowMlsd()- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getPermType
Returns the format identifier for the permissions string available for cached listing entryindex. The value is empty when no permissions are available.Value Format
mlsdThe RFC 3659permfact.unixA UNIX/POSIX-style mode string.netwareNetWare trustee rights.openvmsAn OpenVMS protection string.batchStatusFlagsConnect:Enterprise batch status flags.Use
to obtain the corresponding value.getPermissions(int)- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getPermissions
Returns the permissions or status string for cached directory-listing entryindex. The value is empty when the server provides no such metadata. Useto determine how to interpret the result.getPermType(int)Permission type Returned information
mlsdThe RFC 3659permfact. 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 asrwxr-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.
- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getRemoteFileTextC
Downloads the remote file atremoteFilename, decodes the bytes using the character encoding named bycharset, and returns the text. A byte-order mark for the selected encoding is recognized and omitted from the returned text.This method controls file-content decoding. The encoding used for the remote path itself is controlled by
.getCommandCharset()- Parameters:
remoteFilename- theremoteFilenameargument (notnull)charset- thecharsetargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getRemoteFileTextData
Downloads the remote file atremoteFilenameand returns its contents decoded using the ANSI character encoding. Usewhen the file uses UTF-8 or another explicitly known encoding.getRemoteFileTextC(String, String)- Parameters:
remoteFilename- theremoteFilenameargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getServerCert
Loads into theCertobject incertthe leaf certificate presented on the currently connected FTPS control channel.The method requires an active TLS control connection. A protected data connection does not replace the control-channel certificate returned here, and the certificate is not retained for retrieval after
.disconnect()- Parameters:
cert- thecertargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getSize
public int getSize(int index)Returns the size in bytes of cached directory-listing entryindexas a 32-bit integer. Usefor large files.getSize64(int)Returns
-1whenindexis invalid or the size is unavailable. Because this method returns an integer, do not useLastMethodSuccessto interpret the result.- Parameters:
index- theindexargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getSize64
public long getSize64(int index)Returns the size in bytes of cached directory-listing entryindexas a 64-bit integer. Returns-1whenindexis invalid or the size is unavailable.Because this method returns an integer, do not use
LastMethodSuccessto interpret the result.- Parameters:
index- theindexargument- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getSizeByName
Returns the size in bytes of the file named byfilenamein the current remote directory as a 32-bit integer. Returns-1when the file is not found or the size cannot be obtained. Usefor large files.getSizeByName64(String)filenamemust be a name, not a path. Set the current remote directory first, and ensurematches the name.getListPattern()- Parameters:
filename- thefilenameargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getSizeByName64
Sends aSIZEcommand forfilenameand returns the remote size in bytes as a 64-bit integer. Returns-1when the server rejects the command, the item is not found, or the size is unavailable.This method does not depend on the indexed directory cache or
. Filename and path case sensitivity are determined by the FTP server and its filesystem.getListPattern()- Parameters:
filename- thefilenameargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
getSizeStr
Returns the size in bytes of cached directory-listing entryindexas a decimal string. This form avoids integer-size limits in languages without a convenient 64-bit type.An out-of-range or negative index is a method failure and sets
LastMethodSuccesstofalse.- Parameters:
index- theindexargument- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getSizeStrByName
Returns the size in bytes of the file named byfilenamein the current remote directory as a decimal string. This form avoids language-specific integer limits.filenamemust be a name, not a path. Set the current remote directory first, and ensurematches the name.getListPattern()- Parameters:
filename- thefilenameargument (notnull)- Returns:
- the result, or
nullif not found (no exception is thrown in that case)
-
getSyncedFiles
Appends to theStringTableinstrTablethe relative paths affected by the most recent synchronization operation. Existing entries instrTableare preserved.The appended paths include files uploaded, downloaded, or deleted by
,syncDeleteRemote(String),syncLocalDir(String, int),syncLocalTree(String, int), orsyncRemoteTree(String, int). When a successful preview has no candidates, no placeholder or empty-string entry is appended.syncRemoteTree2(String, int, boolean, boolean)- Parameters:
strTable- thestrTableargument (notnull)
-
getTextDirListing
Sends a legacyLISTrequest and returns the server's raw textual listing.patternis appended literally as a server-side listing argument. An emptypatternlists the current remote directory; a value such as*.txtsends a command such asLIST *.txt.is also appended literally beforegetListOption()pattern. For example,ListOption = "-a"andpatternequal to*.txtsendLIST -a *.txt.This method does not use
MLSD,NLST,, or the indexed directory cache. Wildcard matching and case sensitivity are determined by the server. The format ofgetListPattern()LISToutput is server-specific.- Parameters:
pattern- thepatternargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
getXmlDirListing
Retrieves a directory listing forpatternand returns parsed entries as an XML document rooted at<remoteDir>. Files are represented by<file>elements containing<name>,<size>, and available time elements; directories are represented by<dir>elements.<remoteDir> <file> <name>report.txt</name> <size>1234</size> <lastModTime full="20260727-065541" ... /> </file> <dir lastModTime="20260727-065542" ...>archive</dir> </remoteDir>When
patternis empty, Chilkat uses the normal listing selection:MLSDwhen allowed and advertised, otherwiseLISTorNLSTaccording to the listing properties. Whenpatternis nonempty, Chilkat sendsLIST, so wildcard matching and case sensitivity are server-dependent.patternThis method does not use or populate the indexed directory cache and
is not applied.getListPattern()Timestamp interpretation: Returned last-modified values are expressed in the client's local time.
MLSDtimestamps are standardized as UTC, while legacyLISTtimestamps may omit timezone and seconds, so exact conversion can be impossible when the server timezone is unknown.- Parameters:
pattern- thepatternargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
largeFileUpload
Uploads the local file atlocalPathto the remote path atremotePathas a sequence of data transfers, each containing up tochunkSizebytes. The first chunk is sent withSTOR, which creates or replacesremotePath, and each later chunk is sent withAPPE.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.
chunkSizeis 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. Transfer counters represent the complete source file, not only the final chunk.Alternative: For ordinary large files, first consider enabling
. Use chunked upload when infrastructure still drops the idle control session.getLargeFileMeasures()- Parameters:
localPath- thelocalPathargument (notnull)remotePath- theremotePathargument (notnull)chunkSize- thechunkSizeargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
loginAfterConnectOnly
public void loginAfterConnectOnly()Authenticates an FTP control connection previously established by. Chilkat sendsconnectOnly()USER,PASS, andACCTwhen required, then performs the normal post-login initialization such asTYPE I,SYST, capability discovery, and UTF-8 setup.If authentication is rejected, the same connection cannot be retried by simply changing the credentials and calling this method again. Disconnect or reconnect with
before attempting another login.connectOnly()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
mGetFiles
Downloads files in the current remote directory that matchremotePatterninto the existing local directory atlocalDir. Subdirectories are not traversed. The method returns the number of files downloaded, or-1on failure.localDirmust already exist; the method does not create it. Existing local files with matching names are replaced. Chilkat sends a server-side listing request forremotePattern, so wildcard matching and case sensitivity depend on the FTP server and remote filesystem.Windows filenames: Remote names that contain characters invalid in a Windows filename are sanitized for the local file. Invalid characters are replaced with underscores and trailing periods are removed. For example,
a<b>c:d|e?f*g.txtis saved asa_b_c_d_e_f_g.txt. Different remote names can potentially map to the same local name.- Parameters:
remotePattern- theremotePatternargument (notnull)localDir- thelocalDirargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
mPutFiles
Uploads each local file matchingpatternto the current remote directory.patternmay include a local directory and wildcard, such asC:/data/*.txt. Subdirectories are not traversed.Local wildcard behavior follows the local operating system; for example, Windows matching is case-insensitive. Only each matching file's basename is used as the remote filename. Existing remote files are replaced using normal
STORbehavior.The method returns the number of files uploaded, or
-1on failure.- Parameters:
pattern- thepatternargument (notnull)- Returns:
- the result (see
ChilkatObject.getLastMethodSuccess()where the description mentions failure)
-
nlstXml
SendsNLSTwithremoteDirPatternappended literally and returns the names in XML form. An emptyremoteDirPatternsendsNLST; a value such as*.txtsendsNLST *.txt.<nlst> <e>name1</e> <e>name2</e> </nlst>
The response is decoded using
.getDirListingCharset()NLSTnormally returns names only; the XML does not distinguish files from directories and does not provide reliable sizes, times, ownership, or permissions. Wildcard matching and case sensitivity are server-dependent.This method does not use or populate the indexed directory cache.
- Parameters:
remoteDirPattern- theremoteDirPatternargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
noop
public void noop()Sends the FTPNOOPcommand. The server must return a positive FTP reply for the method to succeed.Whether
NOOPis accepted before login is server-dependent. This method does not reconnect a closed session.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putFile
Uploads the local filesystem file atlocalFilePathto the remote path atremoteFilePath.Uses the FTP
STORcommand. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.Use
immediately before this call to resume an existing partial remote file.getRestartNext()limits how long the upload may remain blocked without forward progress.getIdleTimeoutMs()- Parameters:
localFilePath- thelocalFilePathargument (notnull)remoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putFileBd
Uploads the bytes contained in theBinDataobject inbinDatato the remote path atremoteFilePath. No character encoding or line-ending conversion is performed.Uses the FTP
STORcommand. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.can be used to upload only the bytes beyond the existing remote size.getRestartNext()- Parameters:
binData- thebinDataargument (notnull)remoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putFileFromTextData
Encodes the text intextDatausing the character encoding named bycharsetand uploads the resulting bytes to the remote file atremoteFilename.Uses the FTP
STORcommand. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.The content charset is independent of
, which controls the encoding of the remote path sent in the FTP command.getCommandCharset()- Parameters:
remoteFilename- theremoteFilenameargument (notnull)textData- thetextDataargument (notnull)charset- thecharsetargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putFileSb
Encodes the text in theStringBuildersbusing the charset named bycharsetand uploads it to the remote path atremoteFilePath. WhenincludeBomistrue, a byte-order mark is included when the selected encoding defines one.Uses the FTP
STORcommand. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.can be used for a resumed upload when the existing remote content and encoded byte sequence are compatible.getRestartNext()- Parameters:
sb- thesbargument (notnull)charset- thecharsetargument (notnull)includeBom- theincludeBomargumentremoteFilePath- theremoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putPlan
Executes the upload plan inplan.alreadyDoneFilenameis the local path of a completion log; each successful plan operation is recorded there.The absolute remote paths stored in the plan are used even if the current remote directory has changed since the plan was created. Local files are opened when this method executes, so changes made after
are reflected in the upload.createPlan(String)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.
- Parameters:
plan- theplanargument (notnull)alreadyDoneFilename- thealreadyDoneFilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
putTree
Uploads the local directory tree rooted atlocalDirinto the current remote directory, creating remote subdirectories as needed. The contents oflocalDirbecome children of the current remote directory.The file and directory filters in
,getSyncMustMatch(),getSyncMustNotMatch(), andgetSyncMustMatchDir()apply. Empty eligible local directories are created remotely. Existing remote files are overwritten withgetSyncMustNotMatchDir()STOR.- Parameters:
localDir- thelocalDirargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
quote
Sends the raw FTP command text incmdto the server. Use this for a command not otherwise exposed by the API.cmdcontains the command and parameters but must not contain CR or LF characters; such input is rejected without sending anything. Chilkat considers the method successful only when the server returns a positive FTP reply. A4xxor5xxreply causes failure and remains available through.getLastReply()The method does not parse command-specific semantics. Use
when the reply text is needed directly.sendCommand(String)- Parameters:
cmd- thecmdargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
removeRemoteDir
Removes the remote directory atremoteDirPath. FTP servers generally require the directory to be empty before it can be removed.A successful call does not refresh the cached indexed listing. Call
before relying on indexed listing methods.clearDirCache()- Parameters:
remoteDirPath- theremoteDirPathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
renameRemoteFile
Renames or moves a remote file or directory fromexistingRemoteFilePathtonewRemoteFilePathusing the FTPRNFR/RNTOsequence. Include directory components innewRemoteFilePathto move the item within the same FTP server.Chilkat does not perform a protective destination-existence check. If
newRemoteFilePathalready exists, one server may reject the rename while another may replace the destination. Cross-directory or cross-filesystem moves are also subject to server policy.A successful rename does not refresh the cached indexed listing. Call
when a fresh listing is required.clearDirCache()- Parameters:
existingRemoteFilePath- theexistingRemoteFilePathargument (notnull)newRemoteFilePath- thenewRemoteFilePathargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
sendCommand
Sends the raw FTP command incmdand returns the complete server reply. The command text is sent as UTF-8;is not applied.getCommandCharset()cmdmust not contain CR or LF characters; such input is rejected without sending anything. A positive FTP reply is returned normally. A4xxor5xxreply is treated as method failure and setsLastMethodSuccesstofalse.- Parameters:
cmd- thecmdargument (notnull)- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setModeZ
public void setModeZ()EnablesMODE Zcompression for subsequent data connections. Call this after connecting and only whenisgetHasModeZ()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.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setOldestDateStr
Sets the oldest remote modification time eligible for.downloadTree(String)oldestDateTimeStris an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600. Files older than the configured value are skipped.The value remains active for subsequent
DownloadTreecalls; it is not consumed after one operation. Avoid relying on exact equality at the boundary because legacyLISTtimestamps can have reduced precision or ambiguous timezone interpretation.- Parameters:
oldestDateTimeStr- theoldestDateTimeStrargument (notnull)
-
setOption
Enables or disables a named compatibility option. Option-name matching is case-insensitive. Prefix a recognized name withNo-to disable it.The recognized option
Microsoft-TLS-1.2-Workaroundchanges 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. An unrecognized option name is rejected.- Parameters:
optionName- theoptionNameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setRemoteFileDateTimeStr
Sets the last-modified time of the remote file atremoteFilename.dateTimeStris an RFC 822 date-time string, such asFri, 21 Nov 1997 09:55:06 -0600.Chilkat converts
dateTimeStrto UTC and sends a server-supported timestamp-setting extension. Depending on the server, the command may beMFMT YYYYMMDDhhmmss pathor the nonstandard timestamp-setting form ofMDTM YYYYMMDDhhmmss path. Precision is one second.FTP has no universally implemented standard for changing a file timestamp; success depends on server extensions and permissions.
- Parameters:
dateTimeStr- thedateTimeStrargument (notnull)remoteFilename- theremoteFilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setRemoteFileDt
Sets the last-modified time of the remote file atremoteFilenameusing theCkDateTimeindt.Chilkat converts the value to UTC and sends a server-supported timestamp-setting extension. Depending on the server, the command may be
MFMT YYYYMMDDhhmmss pathor the nonstandard timestamp-setting form ofMDTM YYYYMMDDhhmmss path. Precision is one second.FTP has no universally implemented standard for changing a file timestamp; success depends on server extensions and permissions.
- Parameters:
dt- thedtargument (notnull)remoteFilename- theremoteFilenameargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSecurePassword
Copies the password from theSecureStringinpasswordfor subsequent FTP authentication. This avoids exposing the password as an ordinary immutable language string. It is equivalent to settingfor login behavior.getPassword()- Parameters:
password- thepasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslCertRequirement
Adds a required match against the FTP server certificate.reqNameselects the certificate field andreqValuespecifies the required value. Supported field names includeSubjectDN,SubjectCN,IssuerDN,IssuerCN, andSAN. Wildcards such as*may be used inreqValue.Requirement-value matching is case-sensitive. Multiple calls add requirements that are combined with logical AND; every requirement must match.
Requirements are evaluated when the FTPS control-channel TLS connection is established. Adding a new requirement after connection does not retroactively reject the existing control channel and is not applied to later protected data-channel handshakes within that session.
Additional check: Certificate requirements supplement normal certificate validation; they should not be used as a substitute for trust-chain, validity, and hostname verification.
- Parameters:
reqName- thereqNameargument (notnull)reqValue- thereqValueargument (notnull)
-
setSslClientCert
Configures theCertincertas the client certificate for FTPS servers that request mutual TLS authentication. The certificate must have access to its private key.- Parameters:
cert- thecertargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslClientCertPem
Configures a client certificate and private key from PEM data or a PEM file.pemDataOrFilenamemay contain the PEM text or the local filesystem path of a PEM file.pemPasswordis the private-key password, or an empty string when the key is not encrypted.- Parameters:
pemDataOrFilename- thepemDataOrFilenameargument (notnull)pemPassword- thepemPasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setSslClientCertPfx
Loads a client certificate and private key from the local PFX/P12 file atpfxFilename.pfxPasswordis the file password. The certificate is used when the FTPS server requests mutual TLS authentication.- Parameters:
pfxFilename- thepfxFilenameargument (notnull)pfxPassword- thepfxPasswordargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setTypeAscii
public void setTypeAscii()Sets the FTP representation type to ASCII for subsequent transfers. In ASCII mode, the FTP endpoints may translate line endings, andcan apply additional conversion on downloads. Use carefully: ASCII mode is intended for text. UsegetCrlfMode()for executables, archives, images, encrypted data, and any file whose bytes must remain unchanged.setTypeBinary()- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setTypeBinary
public void setTypeBinary()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.- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
site
Sends a server-specificSITEcommand.siteCommandcontains the text followingSITE, for exampleRECFM=FB LRECL=600.SITEsubcommands are defined by the server, not by the FTP standard, and may require special permissions.- Parameters:
siteCommand- thesiteCommandargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
sleepMs
public void sleepMs(int millisec)Blocks the calling thread formillisecmilliseconds. This is a utility method and performs no FTP network operation.- Parameters:
millisec- themillisecargument
-
stat
Sends the FTPSTATcommand and returns the server's reply. Depending on the server and session state, the reply may contain status information or a directory listing.Support, accepted arguments, and whether the command is permitted before login are server-dependent.
- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncDeleteRemote
Recursively compares the remote tree rooted at the current remote directory with the local tree rooted atlocalRootand 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
after the call to obtain the relative paths deleted.getSyncedFiles(StringTable)- Parameters:
localRoot- thelocalRootargument (notnull)- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncLocalDir
Synchronizes files from the current remote directory into the local directory atlocalRootwithout descending into subdirectories.modeselects the same download modes documented for.syncLocalTree(String, int)The filters are case-insensitive and match basenames. In mode
99, only unmatched remote files in the current directory are deleted; nested directories are not traversed and their contents are not examined. Extra local files are not deleted.Unsupported mode values fail before an FTP command is sent. Use
afterward to obtain the affected relative paths.getSyncedFiles(StringTable)- Parameters:
localRoot- thelocalRootargument (notnull)mode- themodeargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncLocalTree
Synchronizes the remote tree rooted at the current remote directory into the local directory atlocalRoot.modeselects which files are downloaded or deleted.Mode Action
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 are case-insensitive and match file basenames rather than relative paths. A file is considered newer only when its timestamp is strictly later; equal timestamps do not qualify.
Mode
99deletes remote files that do not exist locally; it does not delete extra local files. Only the mode values shown in the table are valid. Other values fail before any FTP command is sent. Useafterward to obtain the affected relative paths.getSyncedFiles(StringTable)Mode numbers differ by direction: The upload and download synchronization methods do not assign the same meanings to all numeric modes. Use the table for the method being called. 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.
- Parameters:
localRoot- thelocalRootargument (notnull)mode- themodeargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncRemoteTree
Synchronizes the local tree rooted atlocalRootinto the current remote directory.modeselects which files are uploaded.Mode Action
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 are case-insensitive and match file basenames rather than relative paths. A file is considered newer only when its timestamp is strictly later; equal timestamps do not qualify.
Only the mode values shown in the table are valid. Other values fail before any FTP command is sent. Use
afterward to obtain the relative paths uploaded.getSyncedFiles(StringTable)Mode numbers differ by direction: The upload and download synchronization methods do not assign the same meanings to all numeric modes. Use the table for the method being called rather than reusing a mode number from a download operation.
- Parameters:
localRoot- thelocalRootargument (notnull)mode- themodeargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syncRemoteTree2
Provides the upload synchronization behavior and valid modes ofwith traversal and preview controls.syncRemoteTree(String, int)localDirPathis the local root,modeis the upload synchronization mode,bDescendcontrols whether subdirectories are traversed, andbPreviewOnlyselects preview-only mode. File and directory filters apply in both normal and preview operation.When
bPreviewOnlyistrue, files are not uploaded and the absolute candidate file paths are placed in. Required remote directories may still be created during preview. If no files qualify, the preview is empty.getSyncPreview()Unsupported mode values fail before any FTP command is sent and clear
SyncPreview. A failed preview also leaves it empty. A subsequent non-preview synchronization clears the previous preview.- Parameters:
localDirPath- thelocalDirPathargument (notnull)mode- themodeargumentbDescend- thebDescendargumentbPreviewOnly- thebPreviewOnlyargument- Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
syst
SendsSYSTand returns the server's operating-system type reply. Chilkat can use this information when interpreting legacy directory listings.Whether the command is accepted before authentication is server-dependent.
- Returns:
- the result (never
null) - Throws:
ChilkatException- if the operation fails;ChilkatException.getLastErrorText()says why
-
setProgressListener
Installs the listener that receives this object's progress events (abortCheck,percentDone,progressInfo) during its long-running methods; replaces any listener or lambda installed before;nullremoves it.- Parameters:
listener- the listener, ornull- Throws:
IllegalStateException- if called from inside one of this object's own callbacks
-
getProgressListener
Returns the installed listener, ornull.- Returns:
- the listener installed with
setProgressListener(ProgressListener)or one of theon...methods
-
onAbortCheck
Installs a listener whose only callback isabortCheck: called everyHeartbeatMsmilliseconds during a long-running method; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onPercentDone
Installs a listener whose only callback ispercentDone: called with the completion percentage (0..100) as a long-running method progresses; returntrueto abort it. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-
onProgressInfo
Installs a listener whose only callback isprogressInfo: called with a name/value pair of progress information as a long-running method proceeds. Replaces any listener installed before.- Parameters:
callback- the callback, ornullto remove the listener
-