FluentFTP
A connection to a single FTP server. Interacts with any FTP/FTPS server and provides a high-level and low-level API to work with files and folders.
Debugging problems with FTP is much easier when you enable logging. See the FAQ on our Github project page for more info.
Automatic FTP and FTPS connection negotiation.
This method tries every possible combination of the FTP connection properties, and returns the list of successful connection profiles.
You can configure it to stop after finding the first successful profile, or to collect all successful profiles.
You can then generate code for the profile using the FtpProfile.ToCode method.
If no successful profiles are found, a blank list is returned.
Find all successful profiles (false) or stop after finding the first successful profile (true)?
Connect to the given server profile.
Load the given connection profile and configure the FTP client instance accordingly.
Connection profile. Not modified.
Automatic FTP and FTPS connection negotiation.
This method tries every possible combination of the FTP connection properties, and connects to the first successful profile.
Returns the FtpProfile if the connection succeeded, or null if it failed.
Creates a new instance of an FTP Client.
Creates a new instance of an FTP Client, with the given host.
Creates a new instance of an FTP Client, with the given host and credentials.
Creates a new instance of an FTP Client, with the given host, port and credentials.
Creates a new instance of an FTP Client, with the given host, username and password.
Creates a new instance of an FTP Client, with the given host, username, password and account
Creates a new instance of an FTP Client, with the given host, port, username and password.
Creates a new instance of an FTP Client, with the given host, port, username, password and account
Creates a new instance of an FTP Client, with the given host.
Creates a new instance of an FTP Client, with the given host and credentials.
Creates a new instance of an FTP Client, with the given host and credentials.
Creates a new instance of an FTP Client, with the given host and credentials.
Creates a new instance of an FTP Client, with the given host, port and credentials.
Creates a new instance of an FTP Client, with the given host, port and credentials.
Check if the host parameter is valid
Creates a new instance of this class. Useful in FTP proxy classes.
Disconnects from the server, releases resources held by this
object.
Finalizer
Clones the control connection for opening multiple data streams
A new control connection with the same property settings as this one
Connect to the server
Thrown if this object has been disposed.
Connect to the FTP server. Overridden in proxy classes.
Connect to the FTP server. Overridden in proxy classes.
Called during Connect(). Typically extended by FTP proxies.
Populates the capabilities flags based on capabilities
supported by this server. This method is overridable
so that new features can be supported
The reply object from the FEAT command. The InfoMessages property will
contain a list of the features the server supported delimited by a new line '\n' character.
Initiates a connection to the server
AsyncCallback method
State object
IAsyncResult
Ends an asynchronous connection attempt to the server from
returned from
Performs a login on the server. This method is overridable so
that the login procedure can be changed to support, for example,
a FTP proxy.
Performs a login on the server. This method is overridable so
that the login procedure can be changed to support, for example,
a FTP proxy.
On authentication failures
To handle authentication failures without retries, catch FtpAuthenticationException.
Disconnects from the server
Initiates a disconnection on the server
method
State object
IAsyncResult
Ends a call to
returned from
Catches the socket stream ssl validation event and fires the event handlers
attached to this object for validating SSL certificates
The stream that fired the event
The event args used to validate the certificate
Fires the SSL validation event
Event Args
Compare the specified local file with the remote file on the FTP server using various kinds of quick equality checks.
In Auto mode, the file size and checksum are compared.
Comparing the checksum of a file is a quick way to check if the contents of the files are exactly equal without downloading a copy of the file.
You can use the option flags to compare any combination of: file size, checksum, date modified.
The full or relative path to the file on the local file system
The full or relative path to the file on the server
Types of equality checks to perform. Use Auto to compare file size and checksum.
Downloads the specified files into a local single directory.
High-level API that takes care of various edge cases internally.
Supports very large files since it downloads data in chunks.
Same speed as .
The full or relative path to the directory that files will be downloaded into.
The full or relative paths to the files on the server
If the file exists on disk, should we skip it, resume the download or restart the download?
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Used to determine how errors are handled
Provide a callback to track upload progress.
The count of how many files were downloaded successfully. When existing files are skipped, they are not counted.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically switch to true for subsequent attempts.
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Downloads the specified file onto the local file system.
High-level API that takes care of various edge cases internally.
Supports very large files since it downloads data in chunks.
The full or relative path to the file on the local file system
The full or relative path to the file on the server
If the file exists on disk, should we skip it, resume the download or restart the download?
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Provide a callback to track download progress.
FtpStatus flag indicating if the file was downloaded, skipped or failed to transfer.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically be set to true for subsequent attempts.
Downloads the specified file into the specified stream.
High-level API that takes care of various edge cases internally.
Supports very large files since it downloads data in chunks.
The stream that the file will be written to. Provide a new MemoryStream if you only want to read the file into memory.
The full or relative path to the file on the server
The size of the existing file in bytes, or 0 if unknown. The download restarts from this byte index.
Provide a callback to track download progress.
If true then the file was downloaded, false otherwise.
Downloads the specified file and return the raw byte array.
High-level API that takes care of various edge cases internally.
Supports very large files since it downloads data in chunks.
The variable that will receive the bytes.
The full or relative path to the file on the server
The size of the existing file in bytes, or 0 if unknown. The download restarts from this byte index.
Provide a callback to track download progress.
If true then the file was downloaded, false otherwise.
Download a file from the server and write the data into the given stream.
Reads data in chunks. Retries if server disconnects midway.
Calculate transfer chunk size taking rate control into account
Deletes a file on the server
The full or relative path to the file
Begins an asynchronous operation to delete the specified file on the server
The full or relative path to the file
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from BeginDeleteFile
Checks if a file exists on the server.
The full or relative path to the file
True if the file exists
Begins an asynchronous operation to check if a file exists on the
server by taking a file listing of the parent directory in the path
and comparing the results the path supplied.
The full or relative path to the file
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
True if the file exists, false otherwise
Renames an object on the remote file system.
Low level method that should NOT be used in most cases. Prefer MoveFile() and MoveDirectory().
Throws exceptions if the file does not exist, or if the destination file already exists.
The full or relative path to the object
The new full or relative path including the new name of the object
Begins an asynchronous operation to rename an object on the remote file system.
Low level method that should NOT be used in most cases. Prefer MoveFile() and MoveDirectory().
Throws exceptions if the file does not exist, or if the destination file already exists.
The full or relative path to the object
The new full or relative path including the new name of the object
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
Moves a file on the remote file system from one directory to another.
Always checks if the source file exists. Checks if the dest file exists based on the `existsMode` parameter.
Only throws exceptions for critical errors.
The full or relative path to the object
The new full or relative path including the new name of the object
Should we check if the dest file exists? And if it does should we overwrite/skip the operation?
Whether the file was moved
Begins an asynchronous operation to move a file on the remote file system, from one directory to another.
Always checks if the source file exists. Checks if the dest file exists based on the `existsMode` parameter.
Only throws exceptions for critical errors.
The full or relative path to the object
The new full or relative path including the new name of the object
Should we check if the dest file exists? And if it does should we overwrite/skip the operation?
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
Modify the permissions of the given file/folder.
Only works on *NIX systems, and not on Windows/IIS servers.
Only works if the FTP server supports the SITE CHMOD command
(requires the CHMOD extension to be installed and enabled).
Throws FtpCommandException if there is an issue.
The full or relative path to the item
The permissions in CHMOD format
Modify the permissions of the given file/folder.
Only works on *NIX systems, and not on Windows/IIS servers.
Only works if the FTP server supports the SITE CHMOD command
(requires the CHMOD extension to be installed and enabled).
Throws FtpCommandException if there is an issue.
The full or relative path to the item
The permissions in CHMOD format
Modify the permissions of the given file/folder.
Only works on *NIX systems, and not on Windows/IIS servers.
Only works if the FTP server supports the SITE CHMOD command
(requires the CHMOD extension to be installed and enabled).
Throws FtpCommandException if there is an issue.
The full or relative path to the item
The owner permissions
The group permissions
The other permissions
Modify the permissions of the given file/folder.
Only works on *NIX systems, and not on Windows/IIS servers.
Only works if the FTP server supports the SITE CHMOD command
(requires the CHMOD extension to be installed and enabled).
Throws FtpCommandException if there is an issue.
The full or relative path to the item
The owner permissions
The group permissions
The other permissions
Retrieve the permissions of the given file/folder as an FtpListItem object with all "Permission" properties set.
Throws FtpCommandException if there is an issue.
Returns null if the server did not specify a permission value.
Use `GetChmod` if you required the integer value instead.
The full or relative path to the item
Retrieve the permissions of the given file/folder as an integer in the CHMOD format.
Throws FtpCommandException if there is an issue.
Returns 0 if the server did not specify a permission value.
Use `GetFilePermissions` if you required the permissions in the FtpPermission format.
The full or relative path to the item
Recursively dereferences a symbolic link. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
The symbolic link
FtpListItem, null if the link can't be dereferenced
Recursively dereferences a symbolic link
The symbolic link
The maximum depth of recursion that can be performed before giving up.
FtpListItem, null if the link can't be dereferenced
Dereference a FtpListItem object
The item to dereference
Maximum recursive calls
Counter
FtpListItem, null if the link can't be dereferenced
Begins an asynchronous operation to dereference a object
The item to dereference
Maximum recursive calls
AsyncCallback
State Object
IAsyncResult
Begins an asynchronous operation to dereference a object. See the
property for controlling
how deep this method will recurse before giving up.
The item to dereference
AsyncCallback
State Object
IAsyncResult
Ends a call to
IAsyncResult
A , or null if the link can't be dereferenced
Gets the size of a remote file, in bytes.
The full or relative path of the file
-1 if the command fails, otherwise the file size
Gets the file size of an object, without locking
Begins an asynchronous operation to retrieve the size of a remote file
The full or relative path of the file
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
The size of the file, -1 if there was a problem.
Gets the modified time of a remote file.
The full path to the file
The modified time, or if there was a problem
Begins an asynchronous operation to get the modified time of a remote file
The full path to the file
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
The modified time, or if there was a problem
Changes the modified time of a remote file
The full path to the file
The new modified date/time value
Begins an asynchronous operation to get the modified time of a remote file
The full path to the file
The new modified date/time value
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
The modified time, or if there was a problem
Uploads the given file paths to a single folder on the server.
All files are placed directly into the given folder regardless of their path on the local filesystem.
High-level API that takes care of various edge cases internally.
Supports very large files since it uploads data in chunks.
Faster than uploading single files with since it performs a single "file exists" check rather than one check per file.
The full or relative paths to the files on the local file system. Files can be from multiple folders.
The full or relative path to the directory that files will be uploaded on the server
What to do if the file already exists? Skip, overwrite or append? Set this to for fastest performance,
but only if you are SURE that the files do not exist on the server.
Create the remote directory if it does not exist.
Sets if checksum verification is required for a successful upload and what to do if it fails verification (See Remarks)
Used to determine how errors are handled
Provide a callback to track upload progress.
The count of how many files were uploaded successfully. Affected when files are skipped when they already exist.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted the existsMode will automatically be set to .
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Uploads the given file paths to a single folder on the server.
All files are placed directly into the given folder regardless of their path on the local filesystem.
High-level API that takes care of various edge cases internally.
Supports very large files since it uploads data in chunks.
Faster than uploading single files with since it performs a single "file exists" check rather than one check per file.
Files to be uploaded
The full or relative path to the directory that files will be uploaded on the server
What to do if the file already exists? Skip, overwrite or append? Set this to FtpExists.None for fastest performance but only if you are SURE that the files do not exist on the server.
Create the remote directory if it does not exist.
Sets if checksum verification is required for a successful upload and what to do if it fails verification (See Remarks)
Used to determine how errors are handled
Provide a callback to track upload progress.
The count of how many files were downloaded successfully. When existing files are skipped, they are not counted.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted the existsMode will automatically be set to .
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Uploads the specified file directly onto the server.
High-level API that takes care of various edge cases internally.
Supports very large files since it uploads data in chunks.
The full or relative path to the file on the local file system
The full or relative path to the file on the server
What to do if the file already exists? Skip, overwrite or append? Set this to for fastest performance
but only if you are SURE that the files do not exist on the server.
Create the remote directory if it does not exist. Slows down upload due to additional checks required.
Sets if checksum verification is required for a successful upload and what to do if it fails verification (See Remarks)
Provide a callback to track download progress.
FtpStatus flag indicating if the file was uploaded, skipped or failed to transfer.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted the existsMode will automatically be set to .
Uploads the specified stream as a file onto the server.
High-level API that takes care of various edge cases internally.
Supports very large files since it uploads data in chunks.
The full data of the file, as a stream
The full or relative path to the file on the server
What to do if the file already exists? Skip, overwrite or append? Set this to for fastest performance
but only if you are SURE that the files do not exist on the server.
Create the remote directory if it does not exist. Slows down upload due to additional checks required.
Provide a callback to track upload progress.
Uploads the specified byte array as a file onto the server.
High-level API that takes care of various edge cases internally.
Supports very large files since it uploads data in chunks.
The full data of the file, as a byte array
The full or relative path to the file on the server
What to do if the file already exists? Skip, overwrite or append? Set this to for fastest performance
but only if you are SURE that the files do not exist on the server.
Create the remote directory if it does not exist. Slows down upload due to additional checks required.
Provide a callback to track upload progress.
Upload the given stream to the server as a new file. Overwrites the file if it exists.
Writes data in chunks. Retries if server disconnects midway.
Sends progress to the user, either a value between 0-100 indicating percentage complete, or -1 for indeterminate.
Sends progress to the user, either a value between 0-100 indicating percentage complete, or -1 for indeterminate.
Downloads the specified directory onto the local file system.
In Mirror mode, we will download missing files, and delete any extra files from disk that are not present on the server. This is very useful when creating an exact local backup of an FTP directory.
In Update mode, we will only download missing files and preserve any extra files on disk. This is useful when you want to simply download missing files from an FTP directory.
Only downloads the files and folders matching all the rules provided, if any.
All exceptions during downloading are caught, and the exception is stored in the related FtpResult object.
The full path of the local folder on disk to download into. It is created if it does not exist.
The full path of the remote FTP folder that you want to download. If it does not exist, an empty result list is returned.
Mirror or Update mode, as explained above
If the file exists on disk, should we skip it, resume the download or restart the download?
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Only files and folders that pass all these rules are downloaded, and the files that don't pass are skipped. In the Mirror mode, the files that fail the rules are also deleted from the local folder.
Provide a callback to track download progress.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically switch to true for subsequent attempts.
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Returns a listing of all the remote files, indicating if they were downloaded, skipped or overwritten.
Returns a blank list if nothing was transfered. Never returns null.
Get a list of all the files and folders that need to be downloaded
Download all the listed files and folders from the main directory
Delete the extra local files if in mirror mode
Check if the local file can be deleted, based on the DownloadDirectoryDeleteExcluded property
Deletes the specified directory and all its contents.
The full or relative path of the directory to delete
Deletes the specified directory and all its contents.
The full or relative path of the directory to delete
Useful to delete hidden files or dot-files.
Deletes the specified directory and all its contents.
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
Useful to delete hidden files or dot-files.
Checks whether will be called recursively or not.
Begins an asynchronous operation to delete the specified directory and all its contents.
The full or relative path of the directory to delete
Async callback
State object
IAsyncResult
Begins an asynchronous operation to delete the specified directory and all its contents.
The full or relative path of the directory to delete
Useful to delete hidden files or dot-files.
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from BeginDeleteDirectory
Tests if the specified directory exists on the server. This
method works by trying to change the working directory to
the path specified. If it succeeds, the directory is changed
back to the old working directory and true is returned. False
is returned otherwise and since the CWD failed it is assumed
the working directory is still the same.
The path of the directory
True if it exists, false otherwise.
Begins an asynchronous operation to test if the specified directory exists on the server.
This method works by trying to change the working directory to
the path specified. If it succeeds, the directory is changed
back to the old working directory and true is returned. False
is returned otherwise and since the CWD failed it is assumed
the working directory is still the same.
IAsyncResult
The full or relative path of the directory to check for
Async callback
State object
Ends a call to
IAsyncResult returned from BeginDirectoryExists
True if the directory exists. False otherwise.
Creates a directory on the server. If the preceding
directories do not exist, then they are created.
The full or relative path to the new remote directory
Creates a directory on the server
The full or relative path to the new remote directory
Try to force all non-existent pieces of the path to be created
True if directory was created, false if it was skipped
Begins an asynchronous operation to create a remote directory. If the preceding
directories do not exist, then they are created.
The full or relative path to the new remote directory
Async callback
State object
IAsyncResult
Begins an asynchronous operation to create a remote directory
The full or relative path to the new remote directory
Try to create the whole path if the preceding directories do not exist
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
Moves a directory on the remote file system from one directory to another.
Always checks if the source directory exists. Checks if the dest directory exists based on the `existsMode` parameter.
Only throws exceptions for critical errors.
The full or relative path to the object
The new full or relative path including the new name of the object
Should we check if the dest directory exists? And if it does should we overwrite/skip the operation?
Whether the directory was moved
Begins an asynchronous operation to move a directory on the remote file system, from one directory to another.
Always checks if the source directory exists. Checks if the dest directory exists based on the `existsMode` parameter.
Only throws exceptions for critical errors.
The full or relative path to the object
The new full or relative path including the new name of the object
Should we check if the dest directory exists? And if it does should we overwrite/skip the operation?
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
Sets the work directory on the server
The path of the directory to change to
Begins an asynchronous operation to set the working directory on the server
The directory to change to
Async Callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
Gets the current working directory
The current working directory, ./ if the response couldn't be parsed.
Begins an asynchronous operation to get the working directory
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
The current working directory
Uploads the specified directory onto the server.
In Mirror mode, we will upload missing files, and delete any extra files from the server that are not present on disk. This is very useful when publishing an exact copy of a local folder onto an FTP server.
In Update mode, we will only upload missing files and preserve any extra files on the server. This is useful when you want to simply upload missing files to a server.
Only uploads the files and folders matching all the rules provided, if any.
All exceptions during uploading are caught, and the exception is stored in the related FtpResult object.
The full path of the local folder on disk that you want to upload. If it does not exist, an empty result list is returned.
The full path of the remote FTP folder to upload into. It is created if it does not exist.
Mirror or Update mode, as explained above
If the file exists on disk, should we skip it, resume the upload or restart the upload?
Sets if checksum verification is required for a successful upload and what to do if it fails verification (See Remarks)
Only files and folders that pass all these rules are downloaded, and the files that don't pass are skipped. In the Mirror mode, the files that fail the rules are also deleted from the local folder.
Provide a callback to track upload progress.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically switch to true for subsequent attempts.
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Returns a listing of all the remote files, indicating if they were downloaded, skipped or overwritten.
Returns a blank list if nothing was transfered. Never returns null.
Get a list of all the sub directories that need to be created within the main directory
Create all the sub directories within the main directory
Get a list of all the files that need to be uploaded within the main directory
Upload all the files within the main directory
Check if the file is cleared to be uploaded, taking its existance/filesize and existsMode options into account.
Delete the extra remote files if in mirror mode and the directory was pre-existing
Check if the remote file can be deleted, based on the UploadDirectoryDeleteExcluded property
Opens a FXP PASV connection between the source FTP Server and the destination FTP Server
FtpClient instance of the destination FTP Server
A data stream ready to be used
Disposes and disconnects this FTP client if it was auto-created for an internal operation.
Transfer the specified file from the source FTP Server to the destination FTP Server using the FXP protocol.
High-level API that takes care of various edge cases internally.
The full or relative path to the file on the source FTP Server
Valid FTP connection to the destination FTP Server
The full or relative path to destination file on the remote FTP Server
Indicates if the folder should be created on the remote FTP Server
If the file exists on disk, should we skip it, resume the download or restart the download?
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Provide a callback to track download progress.
Returns a FtpStatus indicating if the file was transfered.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically be set to true for subsequent attempts.
Transfers a file from the source FTP Server to the destination FTP Server via the FXP protocol
Transfer the specified directory from the source FTP Server onto the remote FTP Server using the FXP protocol.
You will need to create a valid connection to your remote FTP Server before calling this method.
In Update mode, we will only transfer missing files and preserve any extra files on the remote FTP Server. This is useful when you want to simply transfer missing files from an FTP directory.
Currently Mirror mode is not implemented.
Only transfers the files and folders matching all the rules provided, if any.
All exceptions during transfer are caught, and the exception is stored in the related FtpResult object.
The full or relative path to the folder on the source FTP Server. If it does not exist, an empty result list is returned.
Valid FTP connection to the destination FTP Server
The full or relative path to destination folder on the remote FTP Server
Only Update mode is currently implemented
If the file exists on disk, should we skip it, resume the download or restart the download?
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Only files and folders that pass all these rules are downloaded, and the files that don't pass are skipped. In the Mirror mode, the files that fail the rules are also deleted from the local folder.
Provide a callback to track download progress.
If verification is enabled (All options other than ) the hash will be checked against the server. If the server does not support
any hash algorithm, then verification is ignored. If only is set then the return of this method depends on both a successful
upload & verification. Additionally, if any verify option is set and a retry is attempted then overwrite will automatically switch to true for subsequent attempts.
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Returns a listing of all the remote files, indicating if they were downloaded, skipped or overwritten.
Returns a blank list if nothing was transfered. Never returns null.
Get the first checksum algorithm mutually supported by both servers.
Gets the currently selected hash algorithm for the HASH command.
This feature is experimental. See this link for details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
The flag or if there was a problem.
Begins an asynchronous operation to get the currently selected hash algorithm for the HASH command.
This feature is experimental. See this link for details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
The flag or if there was a problem.
Sets the hash algorithm on the server to use for the HASH command.
If you specify an algorithm not listed in
a will be thrown
so be sure to query that list of Flags before
selecting a hash algorithm. Support for the
HASH command is experimental. Please see
the following link for more details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Hash Algorithm
Thrown if the selected algorithm is not available on the server
Begins an asynchronous operation to set the hash algorithm on the server to use for the HASH command.
If you specify an algorithm not listed in
a will be thrown
so be sure to query that list of Flags before
selecting a hash algorithm. Support for the
HASH command is experimental. Please see
the following link for more details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Hash algorithm to use
Async Callback
State object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
Gets the hash of an object on the server using the currently selected hash algorithm.
Supported algorithms, if any, are available in the
property. You should confirm that it's not equal
to before calling this method
otherwise the server trigger a
due to a lack of support for the HASH command. You can
set the algorithm using the method and
you can query the server for the current hash algorithm
using the method.
Full or relative path of the object to compute the hash for.
The hash of the file.
Thrown if the property is ,
the remote path does not exist, or the command cannot be executed.
Path argument is null
Thrown when an unknown hash algorithm type is returned by the server
Parses the recieved hash value into the FtpHash object
Begins an asynchronous operation to get the hash of an object on the server using the currently selected hash algorithm.
Supported algorithms, if any, are available in the
property. You should confirm that it's not equal
to before calling this method
otherwise the server trigger a
due to a lack of support for the HASH command. You can
set the algorithm using the method and
you can query the server for the current hash algorithm
using the method.
The file you want the server to compute the hash for
AsyncCallback
State object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
Retrieves a checksum of the given file using the specified checksum algorithum, or using the first available algorithm that the server supports.
The algorithm used goes in this order:
1. HASH command; server preferred algorithm. See
2. MD5 / XMD5 / MMD5 commands
3. XSHA1 command
4. XSHA256 command
5. XSHA512 command
6. XCRC command
Full or relative path of the file to checksum
Specify an algorithm that you prefer, or NONE to use the first available algorithm. If the preferred algorithm is not supported, a blank hash is returned.
object containing the value and algorithm. Use the property to
determine if this command was successful. s can be thrown from
the underlying calls.
The command fails
Begins an asynchronous operation to retrieve a checksum of the given file using a checksum method that the server supports, if any.
The algorithm used goes in this order:
1. HASH command; server preferred algorithm. See
2. MD5 / XMD5 / MMD5 commands
3. XSHA1 command
4. XSHA256 command
5. XSHA512 command
6. XCRC command
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
object containing the value and algorithm. Use the property to
determine if this command was successful. s can be thrown from
the underlying calls.
Gets the MD5 hash of the specified file using MD5. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
Full or relative path to remote file
Server response, presumably the MD5 hash.
The command fails
Begins an asynchronous operation to retrieve a MD5 hash. The MD5 command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The MD5 hash of the specified file.
Get the CRC value of the specified file. This is a non-standard extension of the protocol
and may throw a FtpCommandException if the server does not support it.
The path of the file you'd like the server to compute the CRC value for.
The response from the server, typically the XCRC value. FtpCommandException thrown on error
The command fails
Begins an asynchronous operation to retrieve a CRC hash. The XCRC command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The CRC hash of the specified file.
Gets the MD5 hash of the specified file using XMD5. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
Full or relative path to remote file
Server response, presumably the MD5 hash.
The command fails
Begins an asynchronous operation to retrieve a XMD5 hash. The XMD5 command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The MD5 hash of the specified file.
Gets the SHA-1 hash of the specified file using XSHA1. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
Full or relative path to remote file
Server response, presumably the SHA-1 hash.
The command fails
Begins an asynchronous operation to retrieve a SHA1 hash. The XSHA1 command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The SHA-1 hash of the specified file.
Gets the SHA-256 hash of the specified file using XSHA256. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
Full or relative path to remote file
Server response, presumably the SHA-256 hash.
The command fails
Begins an asynchronous operation to retrieve a SHA256 hash. The XSHA256 command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The SHA-256 hash of the specified file.
Gets the SHA-512 hash of the specified file using XSHA512. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
Full or relative path to remote file
Server response, presumably the SHA-512 hash.
The command fails
Begins an asynchronous operation to retrieve a SHA512 hash. The XSHA512 command is non-standard
and not guaranteed to work.
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to
IAsyncResult returned from
The SHA-512 hash of the specified file.
Returns information about a file system object. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefulness of this method for checking for the existence of an object.
The path of the file or folder
Get the accurate modified date using another MDTM command
A FtpListItem object
Begins an asynchronous operation to return information about a remote file system object.
You should check the property for the
flag before calling this method. Failing to do so will result in an InvalidOperationException
being thrown when the server does not support machine listings. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefulness of this method for checking for the existence of an object.
Path of the file or folder
Get the accurate modified date using another MDTM command
Async Callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
A if the command succeeded, or null if there was a problem.
Gets a file listing from the server from the current working directory. Each object returned
contains information about the file that was able to be retrieved.
If a property is equal to then it means the
date in question was not able to be retrieved. If the property
is equal to 0, then it means the size of the object could also not
be retrieved.
An array of FtpListItem objects
Gets a file listing from the server. Each object returned
contains information about the file that was able to be retrieved.
If a property is equal to then it means the
date in question was not able to be retrieved. If the property
is equal to 0, then it means the size of the object could also not
be retrieved.
The path of the directory to list
An array of FtpListItem objects
Gets a file listing from the server. Each object returned
contains information about the file that was able to be retrieved.
If a property is equal to then it means the
date in question was not able to be retrieved. If the property
is equal to 0, then it means the size of the object could also not
be retrieved.
The path of the directory to list
Options that dictate how a list is performed and what information is gathered.
An array of FtpListItem objects
Get the records of a file listing and retry if temporary failure.
Begins an asynchronous operation to get a file listing from the server.
Each object returned contains information about the file that was able to be retrieved.
If a property is equal to then it means the
date in question was not able to be retrieved. If the property
is equal to 0, then it means the size of the object could also not
be retrieved.
AsyncCallback method
State object
IAsyncResult
Begins an asynchronous operation to get a file listing from the server.
Each object returned contains information about the file that was able to be retrieved.
If a property is equal to then it means the
date in question was not able to be retrieved. If the property
is equal to 0, then it means the size of the object could also not
be retrieved.
The path to list
AsyncCallback method
State object
IAsyncResult
Gets a file listing from the server asynchronously
The path to list
Options that dictate how the list operation is performed
AsyncCallback method
State object
IAsyncResult
Ends a call to
IAsyncResult return from
An array of items retrieved in the listing
Recursive method of GetListing, to recurse through directories on servers that do not natively support recursion.
Automatically called by GetListing where required.
Uses flat recursion instead of head recursion.
The path of the directory to list
Options that dictate how a list is performed and what information is gathered.
An array of FtpListItem objects
Returns a file/directory listing using the NLST command.
A string array of file and directory names if any were returned.
Returns a file/directory listing using the NLST command.
The path of the directory to list
A string array of file and directory names if any were returned.
Begin an asynchronous operation to return a file/directory listing using the NLST command.
The path of the directory to list
Async Callback
State object
IAsyncResult
Begin an asynchronous operation to return a file/directory listing using the NLST command.
Async Callback
State object
IAsyncResult
Ends a call to
IAsyncResult object returned from
An array of file and directory names if any were returned.
Used to improve performance of OpenPassiveDataStream.
Enhanced-passive mode is tried once, and if not supported, is not tried again.
Used to improve performance of GetFileSize.
SIZE command is tried, and if the server cannot send it in ASCII mode, we switch to binary each time you call GetFileSize.
However most servers will support ASCII, so we can get the file size without switching to binary, improving performance.
Used to improve performance of GetListing.
You can set this to true by setting the RecursiveList property.
Used to automatically dispose cloned connections after FXP transfer has ended.
These flags must be reset every time we connect, to allow for users to connect to
different FTP servers with the same client object.
These flags must be copied when we quickly clone the connection.
Used for internally synchronizing access to this
object from multiple threads
For usage by FTP proxies only
A list of asynchronous methods that are in progress
Control connection socket stream
Gets a value indicating if this object has already been disposed.
Gets the base stream for talking to the server via
the control connection.
Flags specifying which versions of the internet protocol to
support when making a connection. All addresses returned during
name resolution are tried until a successful connection is made.
You can fine tune which versions of the internet protocol to use
by adding or removing flags here. I.e., setting this property
to FtpIpVersion.IPv4 will cause the connection process to
ignore IPv6 addresses. The default value is ANY version.
Gets or sets the length of time in milliseconds
that must pass since the last socket activity
before calling
on the socket to test for connectivity.
Setting this interval too low will
have a negative impact on performance. Setting this
interval to 0 disables Polling all together.
The default value is 15 seconds.
Gets or sets a value indicating whether a test should be performed to
see if there is stale (unrequested data) sitting on the socket. In some
cases the control connection may time out but before the server closes
the connection it might send a 4xx response that was unexpected and
can cause synchronization errors with transactions. To avoid this
problem the method checks to see if there is any data
available on the socket before executing a command. On Azure hosting
platforms this check can cause an exception to be thrown. In order
to work around the exception you can set this property to false
which will skip the test entirely however doing so eliminates the
best effort attempt of detecting such scenarios. See this thread
for more details about the Azure problem:
https://netftp.codeplex.com/discussions/535879
Gets a value indicating if the connection is alive
When this value is set to true (default) the control connection
is cloned and a new connection the server is established for the
data channel operation. This is a thread safe approach to make
asynchronous operations on a single control connection transparent
to the developer.
Gets or sets the length of time in milliseconds after last command
(NOOP or other) that a NOOP command is sent by .
This is called during downloading/uploading if
is false. Setting this
interval to 0 disables all together.
The default value is 0 (disabled).
When this value is set to true (default) the control connection
will set which features are available by executing the FEAT command
when the connect method is called.
Gets a value indicating if this control connection is a clone. This property
is used with data streams to determine if the connection should be closed
when the stream is closed. Servers typically only allow 1 data connection
per control connection. If you try to open multiple data connections this
object will be cloned for 2 or more resulting in N new connections to the
server.
Gets or sets the text encoding being used when talking with the server. The default
value is however upon connection, the client checks
for UTF8 support and if it's there this property is switched over to
. Manually setting this value overrides automatic detection
based on the FEAT list; if you change this value it's always used
regardless of what the server advertises, if anything.
The server to connect to
The port to connect to. If this value is set to 0 (Default) the port used
will be determined by the type of SSL used or if no SSL is to be used it
will automatically connect to port 21.
Credentials used for authentication
Gets or sets a value that controls the maximum depth
of recursion that will follow symbolic
links before giving up. You can also specify the value
to be used as one of the overloaded parameters to the
method. The default value is 20. Specifying
-1 here means indefinitely try to resolve a link. This is
not recommended for obvious reasons (stack overflow).
Client certificates to be used in SSL authentication process
Delegate used for resolving local address, used for active data connections
This can be used in case you're behind a router, but port forwarding is configured to forward the
ports from your router to your internal IP. In that case, we need to send the router's IP instead of our internal IP.
See example: FtpClient.GetPublicIP -> This uses Ipify api to find external IP
Ports used for Active Data Connection.
Useful when your FTP server has certain ports that are blocked or used for other purposes.
Ports blocked for Passive Data Connection (PASV and EPSV).
Useful when your FTP server has certain ports that are blocked or used for other purposes.
Maximum number of passive connections made in order to find a working port for Passive Data Connection (PASV and EPSV).
Only used if PassiveBlockedPorts is non-null.
Data connection type, default is AutoPassive which tries
a connection with EPSV first and if it fails then tries
PASV before giving up. If you know exactly which kind of
connection you need you can slightly increase performance
by defining a specific type of passive or active data
connection here.
Disconnect from the server without sending QUIT. This helps
work around IOExceptions caused by buggy connection resets
when closing the control connection.
Gets or sets the length of time in milliseconds to wait for a connection
attempt to succeed before giving up. Default is 15000 (15 seconds).
Gets or sets the length of time wait in milliseconds for data to be
read from the underlying stream. The default value is 15000 (15 seconds).
Gets or sets the length of time in milliseconds for a data connection
to be established before giving up. Default is 15000 (15 seconds).
Gets or sets the length of time in milliseconds the data channel
should wait for the server to send data. Default value is
15000 (15 seconds).
Gets or sets a value indicating if should be set on
the underlying stream's socket. If the connection is alive, the option is
adjusted in real-time. The value is stored and the KeepAlive option is set
accordingly upon any new connections. The value set here is also applied to
all future data streams. It has no affect on cloned control connections or
data connections already in progress. The default value is false.
Gets the server capabilities represented by an array of capability flags
Get the hash types supported by the server, if any. This
is a recent extension to the protocol that is not fully
standardized and is not guaranteed to work. See here for
more details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.
Indicates if data channel transfers should be encrypted. Only valid if
property is not equal to .
Indicates if the encryption should be disabled immediately after connecting using a CCC command.
This is useful when you have a FTP firewall that requires plaintext FTP, but your server mandates FTPS connections.
Encryption protocols to use. Only valid if EncryptionMode property is not equal to .
Default value is .NET Framework defaults from the class.
Whether to use SSL Buffering to speed up data transfer during FTP operations.
SSL Buffering is always disabled on .NET 5.0 due to platform issues (see issue 682 in FluentFTP issue tracker).
Checks if FTPS/SSL encryption is currently active.
Useful to see if your server supports FTPS, when using FtpEncryptionMode.Auto.
Event is fired to validate SSL certificates. If this event is
not handled and there are errors validating the certificate
the connection will be aborted.
Not fired if ValidateAnyCertificate is set to true.
Accept any SSL certificate received from the server and skip performing
the validation using the ValidateCertificate callback.
Useful for Powershell users.
Indicates if the certificate revocation list is checked during authentication.
Useful when you need to maintain the certificate chain validation,
but skip the certificate revocation check.
WARNING: Enabling this can cause memory leaks in some conditions (see issue #710 for details).
Gets the type of system/server that we're connected to. Typically begins with "WINDOWS" or "UNIX".
Gets the type of the FTP server software that we're connected to.
Gets the type of the FTP server handler.
This is automatically set based on the detected FTP server, if it is detected.
You can manually set this property to implement handling for a custom FTP server.
Gets the operating system of the FTP server that we're connected to.
Gets the connection type
Gets the last reply received from the server
Controls if the file listings are downloaded in Binary or ASCII mode.
File listing parser to be used.
Automatically calculated based on the type of the server, unless changed.
Culture used to parse file listings
Custom file listing parser to be used.
Callback format to implement your custom FTP listing line parser.
The line from the listing
The server capabilities
The FTP client
Return an FtpListItem object if the line can be parsed, else return null
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
The timezone of the FTP server. If the server is in Tokyo with UTC+9 then set this to 9.
If the server returns timestamps in UTC then keep this 0.
Server timestamps are converted into the given timezone.
ServerTime will return the original timestamp.
LocalTime will convert the timestamp into your local machine's timezone.
UTC will convert the timestamp into UTC format (GMT+0).
You need to set TimeZone and LocalTimeZone (.NET core only) for these to work.
If true, increases performance of GetListing by reading multiple lines
of the file listing at once. If false then GetListing will read file
listings line-by-line. If GetListing is having issues with your server,
set it to false.
The number of bytes read is based upon .
Bytes to read during GetListing. Only honored if is true.
Gets or sets the number of bytes transferred in a single chunk (a single FTP command).
Used by / and /
to transfer large files in multiple chunks.
Gets or sets the size of the file buffer when reading and writing files on the local file system.
Used by / and /
and all the other file and directory transfer methods.
Files within this size are read and written in a single call to the disk, thereby greatly increasing transfer performance. Measured in bytes.
Reduce this if you notice large memory consumption by FluentFTP. Set this to 0 to disable quick transfer.
Gets or sets the retry attempts allowed when a verification failure occurs during download or upload.
This value must be set to 1 or more.
Rate limit for uploads in kbyte/s. Set this to 0 for unlimited speed.
Honored by high-level API such as Upload(), Download(), UploadFile(), DownloadFile()..
Rate limit for downloads in kbytes/s. Set this to 0 for unlimited speed.
Honored by high-level API such as Upload(), Download(), UploadFile(), DownloadFile()..
Controls if zero-byte files should be downloaded or skipped.
If false, then no file is created/overwritten into the filesystem.
Controls if the high-level API uploads files in Binary or ASCII mode.
Controls if the high-level API downloads files in Binary or ASCII mode.
Controls if the UploadDirectory API deletes the excluded files when uploading in Mirror mode.
If true, then any files that are excluded will be deleted from the FTP server if they are
excluded from the local system. This is done to keep the server in sync with the local system.
But if it is false, the excluded files are not touched on the server, and simply ignored.
Controls if the DownloadDirectory API deletes the excluded files when downloading in Mirror mode.
If true, then any files that are excluded will be deleted from the local filesystem if they are
excluded from the FTP server. This is done to keep the local filesystem in sync with the FTP server.
But if it is false, the excluded files are not touched on the local filesystem, and simply ignored.
Controls if the FXP server-to-server file transfer API uses Binary or ASCII mode.
Controls how often the progress reports are sent during an FXP file transfer.
The default value is 1000 (1 second).
Controls if the HOST command is sent immediately after the handshake.
Useful when you are using shared hosting and you need to inform the
FTP server which domain you want to connect to.
Controls which domain is sent with the HOST command.
If this is null, then the Host parameter of the FTP client is sent.
Returns the local end point of the FTP socket, if it is available.
Returns the remote end point of the FTP socket, if it is available.
Connects to the specified URI. If the path specified by the URI ends with a
/ then the working directory is changed to the path specified.
The URI to parse
Indicates if a ssl certificate should be validated when using FTPS schemes
FtpClient object
Connects to the specified URI. If the path specified by the URI ends with a
/ then the working directory is changed to the path specified.
The URI to parse
FtpClient object
Calculate you public internet IP using the ipify service. Returns null if cannot be calculated.
Public IP Address
When last command was sent (NOOP or other), for having
respect the .
Executes a command
The command to execute
The servers reply to the command
Performs execution of the specified command asynchronously
The command to execute
The method
State object
IAsyncResult
Ends an asynchronous command
IAsyncResult returned from BeginExecute
FtpReply object (never null).
Sends the NOOP command according to (effectively a no-op if 0).
Please call as needed to read the "OK" command sent by the server and prevent stale data on the socket.
Note that response is not guaranteed by all FTP servers when sent during file transfers.
true if NOOP command was sent
Retrieves a reply from the server. Do not execute this method
unless you are sure that a reply has been sent, i.e., you
executed a command. Doing so will cause the code to hang
indefinitely waiting for a server reply that is never coming.
FtpReply representing the response from the server
Decodes the given FTP response string into a FtpReply, seperating the FTP return code and message.
Returns true if the string was decoded correctly or false if it is not a standard format FTP response.
Opens the specified type of passive data stream
Type of passive data stream to open
The command to execute that requires a data stream
Restart location in bytes for file transfer
A data stream ready to be used
Parse the host and port number from an EPSV response
Parse the host and port number from an PASV or PASVEX response
Returns the ip address to be sent to the server for the active connection
Opens the specified type of active data stream
Type of passive data stream to open
The command to execute that requires a data stream
Restart location in bytes for file transfer
A data stream ready to be used
Opens a data stream.
The command to execute that requires a data stream
Restart location in bytes for file transfer
The data stream.
Disconnects a data stream
The data stream to close
Open a local port on the given ActivePort or a random port.
Opens the specified file for reading
The full or relative path of the file
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Only set this to false if you are SURE that the file does not exist. If true, it reads the file size and saves it into the stream length.
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Resume location
Only set this to false if you are SURE that the file does not exist. If true, it reads the file size and saves it into the stream length.
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
Only set this to false if you are SURE that the file does not exist. If true, it reads the file size and saves it into the stream length.
A stream for reading the file on the server
Begins an asynchronous operation to open the specified file for reading
The full or relative path of the file
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Async Callback
State object
IAsyncResult
Begins an asynchronous operation to open the specified file for reading
The full or relative path of the file
Resume location
Async Callback
State object
IAsyncResult
Begins an asynchronous operation to open the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
Async Callback
State object
IAsyncResult
Ends a call to
returned from
A readable stream of the remote file
Opens the specified file for writing. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
Full or relative path of the file
A stream for writing to the file on the server
Opens the specified file for writing. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
Full or relative path of the file
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for writing. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
Full or relative path of the file
ASCII/Binary
Only set this to false if you are SURE that the file does not exist. If true, it reads the file size and saves it into the stream length.
A stream for writing to the file on the server
Begins an asynchronous operation to open the specified file for writing
Full or relative path of the file
Async callback
State object
IAsyncResult
Begins an asynchronous operation to open the specified file for writing
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to
returned from
A writable stream
Opens the specified file for appending. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
The full or relative path to the file to be opened
A stream for writing to the file on the server
Opens the specified file for appending. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
The full or relative path to the file to be opened
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for appending. Please call GetReply() after you have successfully transfered the file to read the "OK" command sent by the server and prevent stale data on the socket.
The full or relative path to the file to be opened
ASCII/Binary
Only set this to false if you are SURE that the file does not exist. If true, it reads the file size and saves it into the stream length.
A stream for writing to the file on the server
Begins an asynchronous operation to open the specified file for appending
Full or relative path of the file
Async callback
State object
IAsyncResult
Begins an asynchronous operation to open the specified file for appending
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to
returned from
A writable stream
Sets the data type of information sent over the data stream
ASCII/Binary
Internal method that handles actually setting the data type.
Thrown when a FTP Command error condition occurs.
Thrown when a FTP error condition occurs.
ASCII/Binary.
This method doesn't do any locking to prevent recursive lock scenarios. Callers must do their own locking.
Begins an asynchronous operation to set the data type of information sent over the data stream
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to
IAsyncResult returned from
If reverse is false, converts the date provided by the FTP server into the timezone required locally.
If reverse is true, converts the local timezone date into the date required by the FTP server.
Affected by properties: TimeConversion, TimeZone, LocalTimeZone.
Performs a bitwise and to check if the specified
flag is set on the property.
The to check for
True if the feature was found, false otherwise
Retrieves the delegate for the specified IAsyncResult and removes
it from the m_asyncmethods collection if the operation is successful
Type of delegate to retrieve
The IAsyncResult to retrieve the delegate for
The delegate that generated the specified IAsyncResult
Ensure a relative path is absolute by appending the working dir
Disables UTF8 support and changes the Encoding property
back to ASCII. If the server returns an error when trying
to turn UTF8 off a FtpCommandException will be thrown.
Data shouldn't be on the socket, if it is it probably means we've been disconnected.
Read and discard whatever is there and optionally close the connection.
Returns the stale data as text, if any, or null if none was found.
close the connection?
even read encrypted data?
trace data to logs?
Checks if this FTP/FTPS connection is made through a proxy.
Returns true if the file passes all the rules
Add a custom listener here to get events every time a message is logged.
Log a function call with relevant arguments
The name of the API function
The args passed to the function
Log a message
The type of tracing event
The message to write
Log a message, adding an automatic prefix to the message based on the `eventType`
The type of tracing event
The message to write
Interface for the FtpClient class.
For detailed documentation of the methods, please see the FtpClient class or check the Wiki on the FluentFTP Github project.
Server features
This server said it doesn't support anything!
Supports the MLST command
Supports the SIZE command
Supports the MDTM command
Supports download/upload stream resumes
Supports UTF8
PRET Command used in distributed ftp server software DrFTPD
Server supports the MFMT command for setting the
modified date of an object on the server
Server supports the MFCT command for setting the
created date of an object on the server
Server supports the MFF command for setting certain facts
about file system objects. It typically allows you to modify
the last modification time, creation time, UNIX group/owner/mode of a file.
Server supports the STAT command
Support for the HASH command
Support for the MD5 command
Support for the XMD5 command
Support for the XCRC command
Support for the XSHA1 command
Support for the XSHA256 command
Support for the XSHA512 command
Support for the EPSV file-transfer command
Support for the CPSV command
Support for the NOOP command
Support for the CLNT command
Support for the SSCN command
Support for the SITE MKDIR (make directory) server-specific command for ProFTPd
Support for the SITE RMDIR (remove directory) server-specific command for ProFTPd
Support for the SITE UTIME server-specific command for ProFTPd
Support for the SITE SYMLINK server-specific command for ProFTPd
Support for the AVBL (get available space) server-specific command for Serv-U
Support for the THMB (get image thumbnail) server-specific command for Serv-U
Support for the RMDA (remove directory) server-specific command for Serv-U
Support for the DSIZ (get directory size) server-specific command for Serv-U
Support for the HOST (get host) server-specific command for Serv-U
Support for the CCC (Clear Command Channel) command, which makes a secure FTP channel revert back to plain text.
Support for the MODE Z (compression enabled) command, which says that the server supports ZLIB compression for all transfers
Support for the LANG (language negotiation) command.
Support for the MMD5 (multiple MD5 hash) command.
Flags that control how file comparison is performed. If you are unsure what to use, set it to Auto.
Compares the file size and the checksum of the file (using the first supported hash algorithm).
The local and remote file sizes and checksums should exactly match for the file to be considered equal.
Compares the file size.
Both file sizes should exactly match for the file to be considered equal.
Compares the date modified of the file.
Both dates should exactly match for the file to be considered equal.
Compares the checksum or hash of the file using the first supported hash algorithm.
Both checksums should exactly match for the file to be considered equal.
The result of a file comparison operation.
Success. Local and remote files are exactly equal.
Failure. Local and remote files do not match.
Failure. Either the local or remote file does not exist.
Failure. Checksum verification is enabled and your server does not support any hash algorithm.
Data connection type
This type of data connection attempts to use the EPSV command
and if the server does not support EPSV it falls back to the
PASV command before giving up unless you are connected via IPv6
in which case the PASV command is not supported.
Passive data connection. EPSV is a better
option if it's supported. Passive connections
connect to the IP address dictated by the server
which may or may not be accessible by the client
for example a server behind a NAT device may
give an IP address on its local network that
is inaccessible to the client. Please note that IPv6
does not support this type data connection. If you
ask for PASV and are connected via IPv6 EPSV will
automatically be used in its place.
Same as PASV except the host supplied by the server is ignored
and the data connection is made to the same address that the control
connection is connected to. This is useful in scenarios where the
server supplies a private/non-routable network address in the
PASV response. It's functionally identical to EPSV except some
servers may not implement the EPSV command. Please note that IPv6
does not support this type data connection. If you
ask for PASV and are connected via IPv6 EPSV will
automatically be used in its place.
Extended passive data connection, recommended. Works
the same as a PASV connection except the server
does not dictate an IP address to connect to, instead
the passive connection goes to the same address used
in the control connection. This type of data connection
supports IPv4 and IPv6.
This type of data connection attempts to use the EPRT command
and if the server does not support EPRT it falls back to the
PORT command before giving up unless you are connected via IPv6
in which case the PORT command is not supported.
Active data connection, not recommended unless
you have a specific reason for using this type.
Creates a listening socket on the client which
requires firewall exceptions on the client system
as well as client network when connecting to a
server outside of the client's network. In addition
the IP address of the interface used to connect to the
server is the address the server is told to connect to
which, if behind a NAT device, may be inaccessible to
the server. This type of data connection is not supported
by IPv6. If you specify PORT and are connected via IPv6
EPRT will automatically be used instead.
Extended active data connection, not recommended
unless you have a specific reason for using this
type. Creates a listening socket on the client
which requires firewall exceptions on the client
as well as client network when connecting to a
server outside of the client's network. The server
connects to the IP address it sees the client coming
from. This type of data connection supports IPv4 and IPv6.
Type of data transfer to do
ASCII transfer
Binary transfer
Controls how timestamps returned by the server are converted.
Returns the server timestamps in Server Time. No timezone conversion is performed.
Returns the server timestamps in Local Time.
Ensure that the TimeZone property is correctly set to the server's timezone.
If you are on .NET Core/.NET Standard, you need to set the LocalTimeZone property for this to work.
Returns the server timestamps in UTC (Coordinated Universal Time).
Ensure that the TimeZone property is correctly set to the server's timezone.
Defines the type of encryption to use
Plain text.
FTPS encryption is used from the start of the connection, port 990.
Connection starts in plain text and FTPS encryption is enabled
with the AUTH command immediately after the server greeting.
FTPS encryption is used if supported by the server, otherwise it falls back to plaintext FTP communication.
Defines how multi-file processes should handle a processing error.
& Cannot Be Combined
No action is taken upon errors. The method absorbs the error and continues.
If any files have completed successfully (or failed after a partial download/upload) then should be deleted.
This will simulate an all-or-nothing transaction downloading or uploading multiple files. If this option is not
combined with or then the method will
continue to process all items whether if they are successful or not and then delete everything if a failure was
encountered at any point.
The method should stop processing any additional files and immediately return upon encountering an error.
Cannot be combined with
The method should stop processing any additional files and immediately throw the current error.
Cannot be combined with
Type of file system of object
The default subtype.
A sub directory within the listed directory.
(Only set when machine listing is available and type is 'dir')
The self directory.
(Only set when machine listing is available and type is 'cdir')
The parent directory.
(Only set when machine listing is available and type is 'pdir')
Type of file system of object
A file
A directory
A symbolic link
Determines how we handle downloading and uploading folders
Dangerous but useful method!
Uploads/downloads all the missing files to update the server/local filesystem.
Deletes the extra files to ensure that the target is an exact mirror of the source.
Safe method!
Uploads/downloads all the missing files to update the server/local filesystem.
Different types of hashing algorithms for computing checksums.
HASH command is not supported
SHA-1
SHA-256
SHA-512
MD5
CRC
IP Versions to allow when connecting
to a server.
Internet Protocol Version 4
Internet Protocol Version 6
Allow any supported version
Flags that can control how a file listing is performed. If you are unsure what to use, set it to Auto.
Tries machine listings (MDTM command) if supported,
and if not then falls back to OS-specific listings (LIST command)
Load the modify date using MDTM when it could not
be parsed from the server listing. This only pertains
to servers that do not implement the MLSD command.
Load the file size using the SIZE command when it
could not be parsed from the server listing. This
only pertains to servers that do not support the
MLSD command.
Combines the Modify and Size flags
Show hidden/dot files. This only pertains to servers
that do not support the MLSD command. This option
makes use the non standard -a parameter to LIST to
tell the server to show hidden files. Since it's a
non-standard option it may not always work. MLSD listings
have no such option and whether or not a hidden file is
shown is at the discretion of the server.
Force the use of OS-specific listings (LIST command) even if
machine listings (MLSD command) are supported by the server
Use the NLST command instead of LIST for a reliable file listing
Force the use of the NLST command (the slowest mode) even if machine listings
and OS-specific listings are supported by the server
Try to dereference symbolic links, and stored the linked file/directory in FtpListItem.LinkObject
Sets the ForceList flag and uses `LS' instead of `LIST' as the
command for getting a directory listing. This option overrides
ForceNameList and ignores the AllFiles flag.
Gets files within subdirectories as well. Adds the -r option to the LIST command.
Some servers may not support this feature.
Do not retrieve path when no path is supplied to GetListing(),
instead just execute LIST with no path argument.
Include two extra items into the listing, for the current directory (".")
and the parent directory (".."). Meaningless unless you want these two
items for some reason.
Force the use of STAT command for getting file listings
Determines how we handle partially downloaded files
Restart the download of a file if it is partially downloaded.
Overwrites the file if it exists on disk.
Resume the download of a file if it is partially downloaded.
Appends to the file if it exists, by checking the length and adding the missing data.
If the file doesn't exist on disk, a new file is created.
Blindly skip downloading the file if it exists on disk, without any more checks.
This is only included to be compatible with legacy behaviour.
Defines the operating system of the FTP server.
Unknown operating system
Definitely Windows or Windows Server
Definitely Unix or AIX-based server
Definitely VMS or OpenVMS server
Definitely IBM OS/400 server
Definitely IBM z/OS server
Definitely SUN OS/Solaris server
If the value is exactly equal to X
If the value is anything except for X
If the value is less than X
If the value is less than or equal to X
If the value is more than X
If the value is more than or equal to X
If the value is between the range of X and Y
If the value is outside the range of X and Y
The type of response the server responded with
Use the custom parser that you have set on the FtpClient object (ListingCustomParser property)
Automatically detect the file listing parser to use based on the FTP server (SYST command).
Machine listing parser, works on any FTP server supporting the MLST/MLSD commands.
File listing parser for Windows/IIS.
File listing parser for Unix.
Alternate parser for Unix. Use this if the default one does not work.
File listing parser for Vax/VMS/OpenVMS.
File listing parser for IBM OS400.
File listing parser for Tandem/Nonstop Guardian OS.
Types of file permissions
No access
Executable
Writable
Readable
This enum is obsolete. Please use FtpRemoteExists instead.
Defines the behavior for uploading/downloading files that already exist
Do not check if the file exists. A bit faster than the other options.
Only use this if you are SURE that the file does not exist on the server.
Otherwise it can cause the UploadFile method to hang due to filesize mismatch.
Skip the file if it exists, without any more checks.
Overwrite the file if it exists.
Append to the file if it exists, by checking the length and adding the missing data.
Append to the file, but don't check if it exists and add missing data.
This might be required if you don't have permissions on the server to list files in the folder.
Only use this if you are SURE that the file does not exist on the server otherwise it can cause the UploadFile method to hang due to filesize mismatch.
The type of response the server responded with
No response
Success
Success
Success
Temporary failure
Permanent failure
Determines how SSL Buffering is handled
Enables buffering in all cases except when using FTP proxies.
Always disables SSL Buffering to reduce FTPS connectivity issues.
Always enables SSL Buffering to massively speed up FTPS operations.
Defines the type of the FTP server software.
Add constants here as you add detection scripts for individual server types.
Unknown FTP server software
Definitely PureFTPd server
Definitely VsFTPd server
Definitely ProFTPD server
Definitely FileZilla server
Definitely OpenVMS server
Definitely Windows CE FTP server
Definitely WuFTPd server
Definitely GlobalScape EFT server
Definitely HP NonStop/Tandem server
Definitely Serv-U server
Definitely Cerberus FTP server
Definitely Windows Server/IIS FTP server
Definitely CrushFTP server
Definitely glFTPd server
Definitely Homegate FTP server
Definitely BFTPd server
Definitely FTP2S3 gateway server
Definitely XLight FTP server
Definitely Sun OS Solaris FTP server
Definitely IBM z/OS FTP server
Definitely FritzBox FTP server
Definitely WS_FTP server
Types of special UNIX permissions
No special permissions are set
Sticky bit is set
SGID bit is set
SUID bit is set
The result of an upload or download operation
The upload or download failed with an error transfering, or the source file did not exist
The upload or download completed succesfully
The upload or download was skipped because the file already existed on the target
Defines the level of the tracing message. Depending on the framework version this is translated
to an equivalent logging level in System.Diagnostices (if available)
Used for logging Debug or Verbose level messages
Used for logging Informational messages
Used for logging non-fatal or ignorable error messages
Used for logging Error messages that may need investigation
Defines if additional verification and actions upon failure that
should be performed when uploading/downloading files using the high-level APIs. Ignored if the
FTP server does not support any hashing algorithms.
No verification of the file is performed
The checksum of the file is verified, if supported by the server.
If the checksum comparison fails then we retry the download/upload
a specified amount of times before giving up. (See )
The checksum of the file is verified, if supported by the server.
If the checksum comparison fails then the failed file will be deleted.
If combined with , then
the deletion will occur if it fails upon the final retry.
The checksum of the file is verified, if supported by the server.
If the checksum comparison fails then an exception will be thrown.
If combined with , then the throw will
occur upon the failure of the final retry, and/or if combined with
the method will throw after the deletion is processed.
The checksum of the file is verified, if supported by the server.
If the checksum comparison fails then the method returns false and no other action is taken.
Event fired if a bad SSL certificate is encountered. This even is used internally; if you
don't have a specific reason for using it you are probably looking for FtpSslValidation.
Event is fired when a SSL certificate needs to be validated
The control connection that triggered the event
Event args
Event args for the FtpSslValidationError delegate
The certificate to be validated
The certificate chain
Validation errors, if any.
Gets or sets a value indicating if this certificate should be accepted. The default
value is false. If the certificate is not accepted, an AuthenticationException will
be thrown.
Exception triggered on FTP authentication failures
Initializes a new instance of a FtpAuthenticationException
Status code
Associated message
Initializes a new instance of a FtpAuthenticationException
The FtpReply to build the exception from
Must be implemented so every Serializer can Deserialize the Exception
Exception triggered on FTP command failures
Gets the completion code associated with the response
The type of response received from the last command executed
Initializes a new instance of a FtpResponseException
Status code
Associated message
Initializes a new instance of a FtpResponseException
The FtpReply to build the exception from
Must be implemented so every Serializer can Deserialize the Exception
FTP related error
Initializes a new instance of the class.
The error message
Initializes a new instance of the class with an inner exception.
The error message that explains the reason for the exception.
The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.
Must be implemented so every Serializer can Deserialize the Exception
Exception thrown by FtpListParser when parsing of FTP directory listing fails.
Creates a new FtpListParseException.
Must be implemented so every Serializer can Deserialize the Exception
Exception is thrown by FtpSocketStream when there is no FTP server socket to connect to.
Creates a new FtpMissingSocketException.
The original exception.
Must be implemented so every Serializer can Deserialize the Exception
Extension methods related to FTP tasks
Check if operation can resume after .
Received exception.
Result of checking.
Exception is thrown when TLS/SSL encryption could not be negotiated by the FTP server.
Default constructor
Custom error message
Error message
Must be implemented so every Serializer can Deserialize the Exception
Extension methods related to FTP tasks
Checks if the array is null or 0 length.
Checks if the array is null or 0 length.
Adds a prefix to the given strings, returns a new array.
Ensures the given item is only added once. If it was not present true is returned, else false is returned.
Extension methods related to FTP tasks
Converts the FTP date string into a DateTime object, without performing any timezone conversion.
The date string
Date formats to try parsing the value from (eg "yyyyMMddHHmmss")
A object representing the date, or if there was a problem
Generates an FTP date-string from the DateTime object, without performing any timezone conversion.
The date value
A string representing the date
Extension methods related to FTP tasks
Validates that the FtpError flags set are not in an invalid combination.
The error handling options set
True if a valid combination, otherwise false
Checks if the operation was successful or skipped (indicating success).
Checks if the operation has failed.
Extension methods related to FTP tasks
Checks if the given file exists in the given file listing.
Supports servers that return: 1) full paths, 2) only filenames, 3) full paths without slash prefixed
The listing returned by GetNameListing
The full file path you want to check
Checks if the given file exists in the given file listing.
The listing returned by GetListing
The full file path you want to check
Extension methods related to FTP tasks
Converts a file size in bytes to a string representation (eg. 12345 becomes 12.3 KB)
Converts a file size in bytes to a string representation (eg. 12345 becomes 12.3 KB)
Converts a file size in bytes to a string representation (eg. 12345 becomes 12.3 KB)
Converts a file size in bytes to a string representation (eg. 12345 becomes 12.3 KB)
Parses a line from a file listing using the first successful parser, or the specified parser.
Returns an FtpListItem object representing the parsed line, or null if the line was unable to be parsed.
the FTP connection that owns this parser
current parser, or parser set by user
parser calculated based on system type (SYST command)
if we have detected that the current parser is valid
Is the version number returned as part of the filename?
Some VMS FTP servers do not permit a file to be deleted unless
the filename includes the version number. Note that directories are
never returned with the version number.
Initializes a new instance of the class.
An existing object
Try to auto-detect which parser is suitable given a system string.
Parse raw file from server into a file object, using the currently active parser.
Validate if the current parser is correct, or if another parser seems more appropriate.
Validate if the current parser is correct
Used for transaction logging and debug information.
Should the trace listeners be flushed immediately after writing to them?
Should the log entries be written with a prefix of "FluentFTP"?
Useful if you have a single TraceListener shared across multiple libraries.
Add a TraceListner to the collection. You can use one of the predefined
TraceListeners in the System.Diagnostics namespace, such as ConsoleTraceListener
for logging to the console, or you can write your own deriving from
System.Diagnostics.TraceListener.
The TraceListener to add to the collection
Remove the specified TraceListener from the collection
The TraceListener to remove from the collection.
Should FTP communication be logged to console?
Set this to a file path to append all FTP communication to it.
Should the function calls be logged in Verbose mode?
Should the FTP server IP addresses be included in the logs?
Should the FTP usernames be included in the logs?
Should the FTP passwords be included in the logs?
Should we trace at all?
Write to the TraceListeners
The message to write
Write to the TraceListeners
The message to write
Write to the TraceListeners
The type of tracing event
The message to write
Write to the TraceListeners, for the purpose of logging a API function call
The name of the API function
The args passed to the function
Write to the TraceListeners
The type of tracing event
A formattable string to write
Helper class to convert FtpHashAlgorithm
Get FtpHashAlgorithm from it's string representation
Name of the hash algorithm
The FtpHashAlgorithm
Get string representation of FtpHashAlgorithm
FtpHashAlgorithm to be converted into string
Name of the hash algorithm
Extension methods related to FTP tasks
Returns true if the given path is a directory path.
Ensures the given directory exists.
Combine the given base path with the relative path
The local ports.
Checks if the given listing is a valid IBM OS/400 file listing
Parses IBM OS/400 format listings
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Parses the last modified date from IBM OS/400 format listings
Parses MLSD/MLST format listings
A line from the listing
Server capabilities
The FTP client
FtpListItem if the item is able to be parsed
Parses the date modified field from MLSD/MLST format listings
Parses the file size field from MLSD/MLST format listings
Parses the permissions from MLSD/MLST format listings
Checks if the given listing is a valid NonStop file listing
Parses NonStop format listings
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Parses the directory type and file size from NonStop format listings
Parses the last modified date from NonStop format listings
Checks if the given listing is a valid Unix file listing
Parses Unix format listings
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Parses the permissions from Unix format listings
Parses the link count from Unix format listings
Parses the owner and group permissions from Unix format listings
Parses the file size from Unix format listings
Parses day-of-month from Unix format listings
Parses the file or folder name from Unix format listings
Parses the last modified date from Unix format listings
Parses the last modified year from Unix format listings
Parses the last modified date from Unix format listings
Parses Unix format listings with alternate parser
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Checks if the given listing is a valid VMS file listing
Parses Vax/VMS format listings
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Parses the file size from Vax/VMS format listings
Parses the owner and group permissions from Vax/VMS format listings
Parses the permissions from Vax/VMS format listings
Parses the last modified date from Vax/VMS format listings
Checks if the given listing is a valid IIS/DOS file listing
Parses IIS/DOS format listings
The FTP client
A line from the listing
FtpListItem if the item is able to be parsed
Parses the file or folder name from IIS/DOS format listings
Parses the file size and checks if the item is a directory from IIS/DOS format listings
Parses the last modified date from IIS/DOS format listings
Extension methods related to FTP tasks
Calculates the CHMOD value from the permissions flags
Calculates the permissions flags from the CHMOD value
Calculate the CHMOD integer value given a set of permissions.
Checks if the permission value has the given flag
Extension methods related to FTP tasks
Checks if this FTP path is a top level path
Converts the specified path into a valid FTP file system path
The file system path
A path formatted for FTP
Creates a valid FTP path by appending the specified segments to this string
This string
The path segments to append
A valid FTP path
Gets the parent directory path (formatted for a FTP server)
The path
The parent directory path
Gets the file name and extension from the path
The full path to the file
The file name
Checks if the given path is a root directory or working directory path
Converts a Windows or Unix-style path into its segments for segment-wise processing
Get the full path of a given FTP Listing entry
Extension methods related to FTP tasks
Checks if every character in the string is whitespace, or the string is null.
Checks if the string is null or 0 length.
Join the given strings by a delimiter.
Join the given strings by a delimiter.
Adds a prefix to the given strings, returns a new array.
Adds a prefix to the given strings, returns a new array.
Ensure a string has the given prefix
Ensure a string has the given postfix
Remove a prefix from a string, only if it has the given prefix
Remove a postfix from a string, only if it has the given postfix
Escape a string into a valid C# string literal.
Implementation from StackOverflow - https://stackoverflow.com/a/14087738
Split into fields by splitting on tokens
Checks if all the characters in this string are digits or dots
Checks if the string contains any of the given values
Checks if RexEx Pattern is valid
Checks if the reply contains any of the known error strings
Extension methods related to FTP tasks
Ensures that the URI points to a server, and not a directory or invalid path.
Object that keeps track of an active FXP Connection between 2 FTP servers.
A connection to the FTP server where the file or folder is currently stored
A connection to the destination FTP server where you want to create the file or folder
A connection to the destination FTP server used to track progress while transfer is going on.
Gets a value indicating if this object has already been disposed.
Closes an FXP connection by disconnecting and disposing off the FTP clients that are
cloned for this FXP connection. Manually created FTP clients are untouched.
Represents a computed hash of an object
on the FTP server. See the following link
for more information:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Gets the algorithm that was used to compute the hash
Gets the computed hash returned by the server
Gets a value indicating if this object represents a
valid hash response from the server.
Computes the hash for the specified file and compares
it to the value in this object. CRC hashes are not supported
because there is no built-in support in the .net framework and
a CRC implementation exceeds the scope of this project. If you
attempt to call this on a CRC hash a will
be thrown.
The file to compute the hash for
True if the computed hash matches what's stored in this object.
Thrown if called on a CRC Hash
Computes the hash for the specified stream and compares
it to the value in this object. CRC hashes are not supported
because there is no built-in support in the .net framework and
a CRC implementation exceeds the scope of this project. If you
attempt to call this on a CRC hash a will
be thrown.
The stream to compute the hash for
True if the computed hash matches what's stored in this object.
Thrown if called on a CRC Hash
Creates an empty instance.
Represents a file system object on the server
Blank constructor, you will need to fill arguments manually.
NOTE TO USER : You should not need to construct this class manually except in advanced cases. Typically constructed by GetListing().
Constructor with mandatory arguments filled.
NOTE TO USER : You should not need to construct this class manually except in advanced cases. Typically constructed by GetListing().
Gets the type of file system object.
Gets the sub type of file system object.
Gets the full path name to the file or folder.
Gets the name of the file or folder. Does not include the full path.
Gets the target a symbolic link points to.
Gets the number of links pointing to this file. Only supplied by Unix servers.
Gets the object that the LinkTarget points to. This property is null unless you pass the
flag in which case GetListing() will try to resolve
the target itself.
Gets the last write time of the object after timezone conversion (if enabled).
Gets the created date of the object after timezone conversion (if enabled).
Gets the last write time of the object before any timezone conversion.
Gets the created date of the object before any timezone conversion.
Gets the size of the object.
Gets special UNIX permissions such as Sticky, SUID and SGID.
Gets the owner permissions.
Gets the group permissions.
Gets the others permissions.
Gets the raw string received for the file permissions.
Use this if the other properties are blank/invalid.
Gets the file permissions in the CHMOD format.
Gets the raw string received for the file's GROUP permissions.
Use this if the other properties are blank/invalid.
Gets the raw string received for the file's OWNER permissions.
Use this if the other properties are blank/invalid.
Gets the input string that was parsed to generate the
values in this object.
Returns a string representation of this object and its properties
A string representing this object
The host IP address or URL of the FTP server
The FTP username and password used to login
A working Encryption Mode found for this profile
A working Ssl Protocol setting found for this profile
A working Data Connection Type found for this profile
A working Encoding setting found for this profile
A working Timeout setting found for this profile, or 0 if default value should be used
A working SocketPollInterval setting found for this profile, or 0 if default value should be used
A working RetryAttempts setting found for this profile, or 0 if default value should be used
Generates valid C# code for this connection profile.
Class to report FTP file transfer progress during upload or download of files
A value between 0-100 indicating percentage complete, or -1 for indeterminate.
Used to track the progress of an individual file transfer.
A value indicating how many bytes have been transferred.
When unable to calculate percentage, having the partial byte count may help in providing some feedback.
A value representing the current Transfer Speed in Bytes per seconds.
Used to track the progress of an individual file transfer.
A value representing the calculated 'Estimated time of arrival'.
Used to track the progress of an individual file transfer.
Stores the absolute remote path of the the current file being transfered.
Stores the absolute local path of the the current file being transfered.
Stores the index of the the file in the listing.
Only used when transfering multiple files or an entire directory.
Stores the total count of the files to be transfered.
Only used when transfering multiple files or an entire directory.
Create a new FtpProgress object for meta progress info.
Create a new FtpProgress object for individual file transfer progress.
Convert Transfer Speed (bytes per second) in human readable format
Create a new FtpProgress object for a file transfer and calculate the ETA, Percentage and Transfer Speed.
Represents a reply to an event on the server
The type of response received from the last command executed
The status code of the response
The message, if any, that the server sent with the response
Informational messages sent from the server
General success or failure of the last command executed
Gets the error message including any informational output
that was sent by the server. Sometimes the final response
line doesn't contain anything informative as to what was going
on with the server. Instead it may send information messages so
in an effort to give as meaningful as a response as possible
the informational messages will be included in the error.
Stores the result of a file transfer when UploadDirectory or DownloadDirectory is used.
Returns true if the file was downloaded, false if it was uploaded.
Gets the type of file system object.
Gets the size of the file.
Gets the name and extension of the file.
Stores the absolute remote path of the the current file being transfered.
Stores the absolute local path of the the current file being transfered.
Gets the error that occuring during transfering this file, if any.
Returns true if the file was downloaded/uploaded, or the file was already existing with the same file size.
Was the file skipped?
Was the file skipped due to failing the rule condition?
Was there an error during transfer? You can read the Exception property for more details.
Convert this result to a FTP list item.
A FTP client with a user@host proxy identification, that works with Blue Coat FTP Service servers.
The 'blue coat variant' forces the client to wait for a 220 FTP response code in
the handshake phase.
A FTP client with a user@host proxy identification.
Proxy information
Creates a new instance of this class. Useful in FTP proxy classes.
Redefine the first dialog: auth with proxy information
A FTP client with a HTTP 1.1 proxy implementation.
A FTP client with a HTTP 1.1 proxy implementation
Proxy information
Redefine the first dialog: HTTP Frame for the HTTP 1.1 Proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Connects to the server using an existing
The existing socket stream
Connects to the server using an existing
The existing socket stream
Host name
Port number
IP version to use
Abstraction of an FtpClient with a proxy
The proxy connection info.
A FTP client with a HTTP 1.1 proxy implementation
Proxy information
Redefine connect for FtpClient : authentication on the Proxy
The socket stream.
A FTP client with a user@host proxy identification.
A FTP client with a user@host proxy identification.
Proxy information
Creates a new instance of this class. Useful in FTP proxy classes.
Redefine the first dialog: auth with proxy information
POCO holding proxy information
Proxy host name
Proxy port
Proxy login credentials
Only accept files that have the given extension, or exclude files of a given extension.
If true, only files of the given extension are uploaded or downloaded. If false, files of the given extension are excluded.
The extensions to match
Only accept files that have the given extension, or exclude files of a given extension.
If true, only files of the given extension are uploaded or downloaded. If false, files of the given extension are excluded.
The extensions to match
Checks if the files has the given extension, or exclude files of the given extension.
Only accept files whose names match the given regular expression(s), or exclude files that match.
If true, only items where one of the supplied regex pattern matches are uploaded or downloaded.
If false, items where one of the supplied regex pattern matches are excluded.
The files names to match
Only accept items that match one of the supplied regex patterns.
If true, only items where one of the supplied regex pattern matches are uploaded or downloaded. If false, items where one of the supplied regex pattern matches are excluded.
The list of regex patterns to match. Only valid patterns are accepted and stored. If none of the patterns are valid, this rule is disabled and passes all objects.
Checks if the FtpListItem Name does match any RegexPattern
Only accept files that have the given name, or exclude files of a given name.
If true, only files of the given name are uploaded or downloaded. If false, files of the given name are excluded.
The files names to match
Only accept files that have the given name, or exclude files of a given name.
If true, only files of the given name are downloaded. If false, files of the given name are excluded.
The files names to match
Checks if the files has the given name, or exclude files of the given name.
Only accept folders whose names match the given regular expression(s), or exclude folders that match.
If true, only folders where one of the supplied regex pattern matches are uploaded or downloaded.
If false, folders where one of the supplied regex pattern matches are excluded.
The files names to match
Only accept items that one of the supplied regex pattern.
If true, only folders where one of the supplied regex pattern matches are uploaded or downloaded. If false, folders where one of the supplied regex pattern matches are excluded.
The list of regex patterns to match. Only valid patterns are accepted and stored. If none of the patterns are valid, this rule is disabled and passes all objects.
Checks if the FtpListItem Name does match any RegexPattern
Only accept folders that have the given name, or exclude folders of a given name.
If true, only folders of the given name are uploaded or downloaded.
If false, folders of the given name are excluded.
The folder names to match
Only accept folders that have the given name, or exclude folders of a given name.
If true, only folders of the given name are downloaded. If false, folders of the given name are excluded.
The folder names to match
Checks if the folders has the given name, or exclude folders of the given name.
Base class used for all FTP Rules. Extend this class to create custom rules.
You only need to provide an implementation for IsAllowed, and add any custom arguments that you require.
Returns true if the object has passed this rules.
Returns true if the object has passed all the rules.
Only accept files that are of the given size, or within the given range of sizes.
Which operator to use
The first value, required for all operators
The second value, only required for BetweenRange and OutsideRange operators
Only accept files that are of the given size, or within the given range of sizes.
Which operator to use
The first value, required for all operators
The second value, only required for BetweenRange and OutsideRange operators.
Checks if the file is of the given size, or within the given range of sizes.
The base class used for all FTP server specific support.
You may extend this class to implement support for custom FTP servers.
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Return true if your server is detected by the given SYST response message.
Its a fallback method if the server did not send an identifying welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Return your FTP server's default capabilities.
Used if your server does not broadcast its capabilities using the FEAT command.
Return true if the path is an absolute path according to your server's convention.
Return the default file listing parser to be used with your FTP server.
Perform server-specific delete directory commands here.
Return true if you executed a server-specific command.
Perform server-specific create directory commands here.
Return true if you executed a server-specific command.
All servers with server-specific handling and support are listed here.
Its possible you can connect to other FTP servers too.
To add support for another standard FTP server:
1) Modify the FtpServer enum
2) Add a new class extending FtpBaseServer
3) Create a new instance of your class in AllServers (below)
To support a custom FTP server you only need to extend FtpBaseServer
and set it on your client.ServerHandler before calling Connect.
Return a known working connection profile from the host/port combination.
Detect the FTP Server based on the welcome message sent by the server after getting the 220 connection command.
Its the primary method.
Get a default FTP Server handler based on the enum value.
Detect the FTP Server based on the response to the SYST connection command.
Its a fallback method if the server did not send an identifying welcome message.
Detect the FTP Server based on the response to the SYST connection command.
Its a fallback method if the server did not send an identifying welcome message.
Populates the capabilities flags based on capabilities given in the list of strings.
Assume the FTP Server's capabilities if it does not support the FEAT command.
Error messages returned by various servers when a file does not exist.
Instead of throwing an error, we use these to detect and handle the file detection properly.
MUST BE LOWER CASE!
Error messages returned by various servers when a file size is not supported in ASCII mode.
MUST BE LOWER CASE!
Error messages returned by various servers when a file transfer temporarily failed.
MUST BE LOWER CASE!
Error messages returned by various servers when a folder already exists.
Instead of throwing an error, we use these to detect and handle the folder creation properly.
MUST BE LOWER CASE!
Server-specific handling for BFTPd FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for Cerberus FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for CrushFTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for FileZilla FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Server-specific handling for FritzBox FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for FTP2S3Gateway FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for glFTPd FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for GlobalScapeEFT FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for HomegateFTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for IBMzOSFTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Return the default file listing parser to be used with your FTP server.
Server-specific handling for NonStop/Tandem FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Return the default file listing parser to be used with your FTP server.
Server-specific handling for OpenVMS FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Return true if your server is detected by the given SYST response message.
Its a fallback method if the server did not send an identifying welcome message.
Return your FTP server's default capabilities.
Used if your server does not broadcast its capabilities using the FEAT command.
Return true if the path is an absolute path according to your server's convention.
Return the default file listing parser to be used with your FTP server.
Server-specific handling for ProFTPD FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Perform server-specific delete directory commands here.
Return true if you executed a server-specific command.
Perform server-specific create directory commands here.
Return true if you executed a server-specific command.
Server-specific handling for PureFTPd FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Server-specific handling for ServU FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Perform server-specific delete directory commands here.
Return true if you executed a server-specific command.
Server-specific handling for SolarisFTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given SYST response message.
Its a fallback method if the server did not send an identifying welcome message.
Server-specific handling for VsFTPd FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Server-specific handling for WindowsCE FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given SYST response message.
Its a fallback method if the server did not send an identifying welcome message.
Return the default file listing parser to be used with your FTP server.
Server-specific handling for WindowsServer/IIS FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Return the default file listing parser to be used with your FTP server.
Server-specific handling for WS_FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Server-specific handling for WuFTPd FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Detect if your FTP server supports the recursive LIST command (LIST -R).
If you know for sure that this is supported, return true here.
Return your FTP server's default capabilities.
Used if your server does not broadcast its capabilities using the FEAT command.
Server-specific handling for XLight FTP servers
Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.
Return true if your server is detected by the given FTP server welcome message.
Base class for data stream connections
Gets the status of the command that was used to open
this data channel
Gets or sets the control connection for this data stream. Setting
the control connection causes the object to be cloned and a new
connection is made to the server to carry out the task. This ensures
that multiple streams can be opened simultaneously.
Gets or sets the length of the stream. Only valid for file transfers
and only valid on servers that support the Size command.
Gets or sets the position of the stream
Reads data off the stream
The buffer to read into
Where to start in the buffer
Number of bytes to read
The number of bytes read
Writes data to the stream
The buffer to write to the stream
Where to start in the buffer
The number of bytes to write to the buffer
Sets the length of this stream
Value to apply to the Length property
Sets the position of the stream. Intended to be used
internally by FtpControlConnection.
The position
Closes the connection and reads the server's reply
Creates a new data stream object
The control connection to be used for carrying out this operation
Finalizer
Returns the file size using synchronous file I/O.
Returns the file size using synchronous file I/O.
Returns a new stream to upload a file from disk.
If the file fits within the fileSizeLimit, then it is read in a single disk call and stored in memory, and a MemoryStream is returned.
If it is larger than that, then a regular read-only FileStream is returned.
Returns a new stream to download a file to disk.
If the file fits within the fileSizeLimit, then a new MemoryStream is returned.
If it is larger than that, then a regular writable FileStream is returned.
If the stream is a MemoryStream, completes the quick download by writing the file to disk.
Stream class used for talking. Used by FtpClient, extended by FtpDataStream
Used for tacking read/write activity on the socket
to determine if Poll() should be used to test for
socket connectivity. The socket in this class will
not know it has been disconnected if the remote host
closes the connection first. Using Poll() avoids
the exception that would be thrown when trying to
read or write to the disconnected socket.
The socket used for talking
Gets or sets the length of time in milliseconds
that must pass since the last socket activity
before calling Poll() on the socket to test for
connectivity. Setting this interval too low will
have a negative impact on performance. Setting this
interval to 0 disables Poll()'ing all together.
The default value is 15 seconds.
Gets the number of available bytes on the socket, 0 if the
socket has not been initialized. This property is used internally
by FtpClient in an effort to detect disconnections and gracefully
reconnect the control connection.
Gets a value indicating if this socket stream is connected
Gets a value indicating if encryption is being used
The non-encrypted stream
The encrypted stream
Gets the underlying stream, could be a NetworkStream or SslStream
Gets a value indicating if this stream can be read
Gets a value indicating if this stream if seekable
Gets a value indicating if this stream can be written to
Gets the length of the stream
Gets the current position of the stream. Trying to
set this property throws an InvalidOperationException()
Event is fired when a SSL certificate needs to be validated
Gets or sets the amount of time to wait for a read operation to complete. Default
value is Timeout.Infinite.
Gets or sets the length of time milliseconds to wait
for a connection succeed before giving up. The default
is 30000 (30 seconds).
Gets the local end point of the socket
Gets the remote end point of the socket
Fires the SSL certificate validation event
Certificate being validated
Certificate chain
Policy errors if any
True if it was accepted, false otherwise
Throws an InvalidOperationException
Ignored
Ignored
Throws an InvalidOperationException
Ignored
Flushes the stream
Bypass the stream and read directly off the socket.
The buffer to read into
The number of bytes read
Reads data from the stream
Buffer to read into
Where in the buffer to start
Number of bytes to be read
The amount of bytes read from the stream
Reads a line from the socket
The type of encoding used to convert from byte[] to string
A line from the stream, null if there is nothing to read
Reads all line from the socket
The type of encoding used to convert from byte[] to string
The size of the buffer
A list of lines from the stream
Writes data to the stream
Buffer to write to stream
Where in the buffer to start
Number of bytes to be read
Writes a line to the stream using the specified encoding
Encoding used for writing the line
The data to write
Disconnects from server
Safely close the socket if its open
Sets socket options on the underlying socket
SocketOptionLevel
SocketOptionName
SocketOptionValue
Connect to the specified host
The host to connect to
The port to connect to
Internet Protocol versions to support during the connection phase
Activates SSL on this stream using default protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certificate against
Activates SSL on this stream using default protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certificate against
A collection of client certificates to use when authenticating the SSL stream
Activates SSL on this stream using the specified protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certificate against
A collection of client certificates to use when authenticating the SSL stream
A bitwise parameter for supported encryption protocols.
Thrown when authentication fails
Conditionally create a SSL BufferStream based on the configuration in FtpClient.SslBuffering.
If SSL Buffering is enabled it returns the BufferStream, else returns the internal NetworkStream.
Deactivates SSL on this stream using the specified protocols and reverts back to plain-text FTP.
Instructs this stream to listen for connections on the specified address and port
The address to listen on
The port to listen on
Accepts a connection from a listening socket
Asynchronously accepts a connection from a listening socket
Completes a BeginAccept() operation
IAsyncResult returned from BeginAccept
.NET SslStream doesn't close TLS connection properly.
It does not send the close_notify alert before closing the connection.
FtpSslStream uses unsafe code to do that.
This is required when we want to downgrade the connection to plaintext using CCC command.
Thanks to Neco @ https://stackoverflow.com/questions/237807/net-sslstream-doesnt-close-tls-connection-properly/22626756#22626756
Send an SSL close_notify alert.
To support progress reporting in .NET 3.5 and .NET 4.0
To support progress reporting in .NET 3.5 and .NET 4.0