FluentFTP
An FTP client that manages 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.
Uses asynchronous operations only. For the sync version use `FtpClient`.
Debugging problems with FTP is much easier when you enable logging. Visit our Github Wiki for more info.
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.
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.
It will throw exceptions for permanent failures like invalid host or invalid credentials.
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.
The coresponding config object for this API
The token that can be used to cancel the entire process
LEGACY CALL FORMAT, to be deleted sometime in the future
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)
Use a new cloned AsyncFtpClient for testing connection profiles (true) or use the source AsyncFtpClient (false)
The token that can be used to cancel the entire process
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
The token that can be used to cancel the entire process
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
The token that can be used to cancel the entire process
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.
The token that can be used to cancel the entire process
Connect to the given server profile.
Connect to the given server profile.
Connect to the server
true indicates that we want a
reconnect to take place.
The token that can be used to cancel the entire process
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.
Creates a remote directory asynchronously
The full or relative path to the new remote directory
Try to create the whole path if the preceding directories do not exist
The token that can be used to cancel the entire process
True if directory was created, false if it was skipped
Creates a remote directory asynchronously. If the preceding
directories do not exist, then they are created.
The full or relative path to the new remote directory
The token that can be used to cancel the entire process
Asynchronously removes a directory and all its contents.
The full or relative path of the directory to delete
The token that can be used to cancel the entire process
Asynchronously removes a directory and all its contents.
The full or relative path of the directory to delete
Useful to delete hidden files or dot-files.
The token that can be used to cancel the entire process
Asynchronously removes a directory. Used by and
.
The full or relative path of the directory to delete
Delete the contents before deleting the folder
Useful to delete hidden files or dot-files.
Delete the top level dir too
Internally used to determine top level
The token that can be used to cancel the entire process
Deletes a file from the server asynchronously
The full or relative path to the file
The token that can be used to cancel the entire process
Tests if the specified directory exists on the server asynchronously. 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 full or relative path of the directory to check for
The token that can be used to cancel the entire process
True if the directory exists. False otherwise.
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.
Disconnects from the server asynchronously
Automatically discover the SSL command limit of your currently connected FTP server.
It returns the value that can be used to set SslSessionLength.
The command to issue
Maximum number of commands to issue
The detected command limit, 0 if infinite
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 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.
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track download progress.
The last byte index that should be downloaded, or 0 if the entire file should be downloaded.
A byte array containing the contents of the downloaded file if successful, otherwise null.
Downloads the specified file and return the raw byte array asynchronously.
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 server
The token that can be used to cancel the entire process
A byte array containing the contents of the downloaded file if successful, otherwise null.
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 an implementation of IProgress to track upload progress.
The token that can be used to cancel the entire process
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 transferred. Never returns null.
Download all the listed files and folders from the main directory
Downloads the specified file onto the local file system asynchronously.
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
Overwrite if you want the local file to be overwritten if it already exists. Append will also create a new file if it doesn't exists
Sets if checksum verification is required for a successful download and what to do if it fails verification (See Remarks)
Provide an implementation of IProgress to track download progress.
The token that can be used to cancel the entire process
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.
Download a remote file to a local file
Download a file from the server and write the data into the given stream asynchronously.
Reads data in chunks. Retries if server disconnects midway.
Setup a resume on failure of download
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
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track upload progress.
Only files that pass all these rules are downloaded, and the files that don't pass are skipped.
Returns a listing of all the remote files, indicating if they were downloaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
If is set and is not set, then individual verification errors will not cause an exception
to propagate from this method.
Remove successfully downloaded files.
Downloads the specified file into the specified stream asynchronously .
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.
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track download progress.
The last byte index that should be downloaded, or 0 if the entire file should be downloaded.
If true then the file was downloaded, false otherwise.
Deletes the contents of the specified directory, without deleting the directory itself.
The full or relative path of the directorys contents to delete
The token that can be used to cancel the entire process
Deletes the contents of the specified directory, without deleting the directory itself.
The full or relative path of the directorys contents to delete
Useful to delete hidden files or dot-files.
The token that can be used to cancel the entire process
Performs an asynchronous execution of the specified command
The command to execute
The token that can be used to cancel the entire process
The servers reply to the command
Things to do after executing a command
Execute a custom FTP command and read the data channel to return its multiline output.
The command to issue which produces output
A list of string objects corresponding to the multi-line response by the server
Execute a custom FTP command and return its multiline output.
The command to issue which produces output
Retry the command execution on temporary failure?
A list of string objects corresponding to the multi-line response by the server
Checks if a file exists on the server asynchronously.
The full or relative path to the file
The token that can be used to cancel the entire process
True if the file exists, false otherwise
Ensure a relative dir is absolute by prepending the working dir
Concat a path and a filename
Ensure a relative path is absolute by prepending the working dir
Retrieves a checksum of the given file using the specified checksum algorithm, or using the first available algorithm that the server supports.
The algorithm used goes in this order:
1. HASH command using the first supported algorithm.
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
The token that can be used to cancel the entire process
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
Gets the hash of the specified file using the given command.
Sets the hash algorithm on the server to be used with the HASH command asynchronously.
Gets the hash of an object on the server using the currently selected hash algorithm.
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
The token that can be used to cancel the entire process
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
The token that can be used to cancel the entire process
Asynchronously gets the size of a remote file, in bytes.
The full or relative path of the file
Value to return if there was an error obtaining the file size, or if the file does not exist
The token that can be used to cancel the entire process
The size of the file, or defaultValue if there was a problem.
Gets the file size of an object, without locking
Gets a file listing from the server asynchronously. 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
Options that dictate how the list operation is performed
The token that can be used to cancel the entire process
An array of items retrieved in the listing
Process the output of the listing command
Get the records of a file listing and retry if temporary failure.
Gets a file listing from the server asynchronously. 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
The token that can be used to cancel the entire process
An array of items retrieved in the listing
Gets a file listing from the server asynchronously. 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 items retrieved in the listing
Recursive method of GetListingAsync, to recurse through directories on servers that do not natively support recursion.
Automatically called by GetListingAsync 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
Gets the modified time of a remote file asynchronously
The full path to the file
The token that can be used to cancel the entire process
The modified time, or if there was a problem
Returns a file/directory listing using the NLST command asynchronously
The path of the directory to list
The token that can be used to cancel the entire process
An array of file and directory names if any were returned.
Returns a file/directory listing using the NLST command asynchronously
An array of file and directory names if any were returned.
Return information about a remote file system object asynchronously.
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 item to retrieve information about
Get the accurate modified date using another MDTM command
The token that can be used to cancel the entire process
Thrown if the server does not support this Capability
A if the command succeeded, or null if there was a problem.
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
The token that can be used to cancel the entire process.
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
The token that can be used to cancel the entire process.
We are waiting for the response to which command?
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
The token that can be used to cancel the entire process.
We are waiting for the response to which command?
Set to true to select the NOOP devouring mode
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
The token that can be used to cancel the entire process.
We are waiting for the response to which command?
Set to true to select the NOOP devouring mode
-1 non-blocking, no timeout, >0 exhaustNoop mode, timeOut in seconds
FtpReply representing the response from the server
Gets the current working directory asynchronously
The current working directory, ./ if the response couldn't be parsed.
Get the reply from the PWD command
The current working directory reply.
If an FTP Server has "different realms", in which realm is the
current working directory.
The realm
Called during . Typically extended by FTP proxies.
Is the current working directory the root?
true if root.
Moves a directory asynchronously 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?
The token that can be used to cancel the entire process
Whether the directory was moved
Moves a file asynchronously 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?
The token that can be used to cancel the entire process
Whether the file was moved
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
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
The token that can be used to cancel the entire process
A data stream ready to be used
Opens the specified file to be appended asynchronously
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.
The token that can be used to cancel the entire process
A stream for writing to the file on the server
Opens the specified file to be appended asynchronously
Full or relative path of the file
ASCII/Binary
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
The token that can be used to cancel the entire process
A stream for writing to the file on the server
Opens a data stream.
The command to execute that requires a data stream
Restart location in bytes for file transfer
The token that can be used to cancel the entire process
The data stream.
Opens a FXP PASV connection between the source FTP Server and the destination FTP Server
Valid FTP connection to the destination FTP Server
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track download progress.
A data stream ready to be used
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
The token that can be used to cancel the entire process
A data stream ready to be used
Opens the specified file for reading asynchronously
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.
The token that can be used to cancel the entire process
A stream for reading the file on the server
Opens the specified file for reading asynchronously
The full or relative path of the file
ASCII/Binary
Resume location
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
The token that can be used to cancel the entire process
A stream for reading the file on the server
Opens the specified file for writing. Please call GetReply() after you have successfully transferred 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.
The token that can be used to cancel the entire process
A stream for writing to the file on the server
Opens the specified file for writing. Please call GetReply() after you have successfully transferred 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
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
The token that can be used to cancel the entire process
A stream for writing to the file on the server
Renames an object on the remote file system asynchronously.
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
The token that can be used to cancel the entire process
Sets the data type of information sent over the data stream asynchronously
ASCII/Binary
The token that can be used to cancel the entire process
Sets the data type of information sent over the data stream asynchronously
ASCII/Binary
The token that can be used to cancel the entire process
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
The token that can be used to cancel the entire process
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
The token that can be used to cancel the entire process
Gets the modified time of a remote file asynchronously
The full path to the file
The new modified date/time value
The token that can be used to cancel the entire process
Sets the working directory on the server asynchronously
The directory to change to
The token that can be used to cancel the entire process
Transfer the specified directory from the source FTP Server onto the remote FTP Server asynchronously 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.
The token that can be used to cancel the entire process
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 transferred. Never returns null.
Make a list of files to transfer
Transfer the files
Transfer the specified file from the source FTP Server to the destination FTP Server asynchronously 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.
The token that can be used to cancel the entire process
Returns a FtpStatus indicating if the file was transferred.
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 asynchronously.
Uploads the specified byte array as a file onto the server asynchronously.
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.
The token that can be used to cancel the entire process.
Provide an implementation of IProgress to track upload progress.
FtpStatus flag indicating if the file was uploaded, skipped or failed to transfer.
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 uploaded, 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 an implementation of IProgress to track upload progress.
The token that can be used to cancel the entire process
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 local files, indicating if they were uploaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
Create all the sub directories within the main directory
Upload all the files within the main directory
Delete the extra remote files if in mirror mode and the directory was pre-existing
Uploads the specified file directly onto the server asynchronously.
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)
The token that can be used to cancel the entire process.
Provide an implementation of IProgress to track upload 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 .
Upload from a local file to a remote file
Upload the given stream to the server as a new file asynchronously. Overwrites the file if it exists.
Writes data in chunks. Retries if server disconnects midway.
Setup a resume on failure of upload
Uploads the given file paths to a single folder on the server asynchronously.
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
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track upload progress.
Only files that pass all these rules are uploaded, and the files that don't pass are skipped.
Returns a listing of all the local files, indicating if they were uploaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
Remove successfully uploaded files.
Uploads the given file paths to a single folder on the server asynchronously.
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
The token that can be used to cancel the entire process
Provide an implementation of IProgress to track upload progress.
Only files that pass all these rules are uploaded, and the files that don't pass are skipped.
Returns a listing of all the local files, indicating if they were uploaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
Get a list of all the files that need to be uploaded
Uploads the specified stream as a file onto the server asynchronously.
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.
The token that can be used to cancel the entire process.
Provide an implementation of IProgress to track upload progress.
FtpStatus flag indicating if the file was uploaded, skipped or failed to transfer.
Verify an FXP transfer
Verify a file transfer
Creates a new instance of an async FTP Client. You will have to setup the FTP host and credentials before connecting.
Creates a new instance of an async FTP Client, with the given host and credentials.
Creates a new instance of an async FTP Client, with the given host and credentials.
Creates a new instance of an async FTP Client, with the given host and credentials.
The base object for FtpClient, AsyncFtpClient
Calculate the position from which to append
Calculate transfer chunk size taking rate control into account
Check if the file is cleared to be uploaded, taking its existence/filesize and existsMode options into account.
Try using the SIZE command to check if file exists
Does the server support checksums?
Is the checksum algorithm valid?
Cleanup the hash result
Get the first checksum algorithm mutually supported by both servers.
Disconnects a data stream
The data stream to close
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.
Delete the extra local files if in mirror mode
Check if the local file can be deleted, based on the DownloadDirectoryDeleteExcluded property
Executes a command
The command to execute
The servers reply to the command
Things to do after executing a command
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.
Forcibly set the capabilities of your FTP server.
By default capabilities are loaded automatically after calling Connect and you don't need to use this method.
This is only for advanced use-cases.
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
Returns true if the file passes all the rules
Get a list of all the files and folders that need to be downloaded
Get a list of all the files and folders that need to be downloaded
Create an FtpResult object for the given file to be downloaded, and check if the file passes the rules.
Get a list of all the files that need to be uploaded within the main directory
Create an FtpResult object for the given file to be uploaded, and check if the file passes the rules.
Parse the advertised port number from an EPSV response and derive an IPAD
Handles (|||nnnn|) and (!!!nnnn!)
Parse the advertised IPAD and advertised port number from a PASV response and derive the final IPAD
Returns the IPAD to be sent to the server for the active connection.
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
We are waiting for the response to which command?
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
We are waiting for the response to which command?
Set to true to select the NOOP devouring mode
FtpReply representing the response from the server
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
We are waiting for the response to which command?
Set to true to select the NOOP devouring mode
-1 non-blocking, no timeout, >0 exhaustNoop mode, timeOut in seconds
FtpReply representing the response from the server
Process the returned data after command was executed
Decodes the given FTP response string into a FtpReply, separating 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.
Make a list of subdirectories to transfer
Get a list of all the sub directories that need to be created within the main directory
Check if the remote file can be deleted, based on the UploadDirectoryDeleteExcluded property
Gets the current working directory
The current working directory, ./ if the response couldn't be parsed.
Get the reply to the PWD command
Parse the string returned from a PWD command
Checks if this FTP/FTPS connection is made through a proxy.
Checks whether will be called recursively or not.
Get a listing
Determine which command to use for getting a listing
Can the server do recursion for us?
Load the given connection profile and configure the FTP client instance accordingly.
Connection profile. Not modified.
Log the version of the running assembly
Log a function call with relevant arguments
The name of the API function
The args passed to the function
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
An optional exeption
Write an optional exeption on a new line
Log a message to the debug output and console.
To allow for external connected classes to use the attached logger.
To allow for external connected classes to use the attached logger.
Should the function calls be logged in Verbose mode?
Add a custom listener here to get events every time a message is logged.
This is the older system, prefer using the ILogger based `Logger` property.
This system will never be removed, you can safely use it in your applications.
All the configuration settings for this FTP client.
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 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.
When last command was sent (NOOP or other), for having /.
Respects the .
To help in logging / debugging
Current FTP client status flags used for improving performance and caching data.
Returns the current FTP client status flags. For advanced use only.
Used for internally synchronizing access to this
object from multiple threads
For usage by FTP proxies only
Control connection socket stream
Gets the base stream for talking to the server via
the control connection.
Gets a value indicating if this object has already been disposed.
Gets the current internet protocol (IPV4 or IPV6) used by the socket connection.
Returns FtpIpVersion.Unknown before connection.
Returns true if the connection to the FTP server is open.
WARNING: Returns true even if our credentials are incorrect but connection to the server is open.
See the IsAuthenticated property if you want to check if we are correctly logged in.
Returns true if the connection to the FTP server is open and if the FTP server accepted our credentials.
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.
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 the server capabilities represented by an array of capability flags
Get the hash types supported by the server for use with the HASH Command.
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
The negotiated SSL/TLS protocol version.
Will return a valid value after connection is complete.
Before connection it will return `SslProtocols.None`.
Checks if FTPS/SSL encryption is currently active.
Useful to see if your server supports FTPS, when using FtpEncryptionMode.Auto.
Easiest way to check if a handler has been attached.
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.
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 operating system of the FTP server that we're connected to.
Gets the connection type
Gets the last reply received from the server
Gets the last replies received from the server
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.
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.
Data shouldn't be on the socket, if it is it probably means we've been disconnected.
Read and discard whatever is there.
Returns the stale data as text, if any, or null if none was found.
copy stale data information to logs?
for the log information
Data shouldn't be on the socket, if it is it probably means we've been disconnected.
Read and discard whatever is there.
Returns the stale data as text, if any, or null if none was found.
copy stale data information to logs?
called from where (text)
The token that can be used to cancel the entire process
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.
Open a local port on the given ActivePort or a random port.
Validate the client before the auto detect process
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
Verify that the client is usable
Clones the FTP client control connection. Used for opening multiple data streams.
You will need to manually connect after cloning.
A new FTP client connection with the same property settings as this one.
Disposes and disconnects this FTP client if it was auto-created for an internal operation.
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
Class responsible for automatically detecting working FTP settings to connect to a target FTP server.
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.
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.
Check if the server refused to support one type of FTPS encryption, and if so blacklist that type of encryption.
Check if its an auth failure or something permanent,
so that we don't need to retry all the connection config combinations and can hard-abort the AutoConnect.
Return the exception if it is a hard failure, or null if no issue is found.
Load the given connection profile and configure the FTP client instance accordingly.
Create a default ValidateCertificate handler that accepts valid certificates.
Return a known working connection profile from the host/port combination.
Modify the `Status.InCriticalSequence` flag based on the FTP command sent, by checking against a list of known critical commands.
A critical sequence will not be interrupted by an automatic reconnect.
Class responsible for masking out sensitive data from FTP logs.
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.
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) Add a new enum in the `FtpServer` enum
2) Add a new class extending `FtpBaseServer` under the `Servers.Handlers` NS
3) Create a new instance of your class in `FtpHandlerIndex.AllServers`
To support a custom FTP server you only need to extend `FtpBaseServer`
and set it on your client.ServerHandler before calling Connect.
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.
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!
Error messages returned by various servers when the connection failed due to wrong TLS version used.
MUST BE LOWER CASE!
An FTP client that manages 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.
Uses synchronous operations only. For the async version use `AsyncFtpClient`.
Debugging problems with FTP is much easier when you enable logging. Visit our Github Wiki for more info.
Creates a new instance of a synchronous FTP Client. You will have to setup the FTP host and credentials before connecting.
Creates a new instance of a synchronous FTP Client, with the given host and credentials.
Creates a new instance of a synchronous FTP Client, with the given host and credentials.
Creates a new instance of a synchronous FTP Client, with the given host and credentials.
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.
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.
It will throw exceptions for permanent failures like invalid host or invalid credentials.
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.
The coresponding config object for this API
LEGACY CALL FORMAT, to be deleted sometime in the future
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)
Use a new cloned FtpClient for testing connection profiles (true) or use the source FtpClient (false)
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 permissions in CHMOD format
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.
Connect
Connect to the given server profile.
Connect to the server
true indicates that we want a
reconnect to take place.
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.
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
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.
Delete completely or leave the top level dir
Internally used to determine top level
Deletes a file on the server
The full or relative path to the file
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.
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.
Disconnects from the server
Automatically discover the SSL command limit of your currently connected FTP server.
It returns the value that can be used to set SslSessionLength.
The command to issue
Maximum number of commands to issue
The detected command limit, 0 if infinite
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.
The last byte index that should be downloaded, or 0 if the entire file should be downloaded.
If true then the file was downloaded, false otherwise.
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 transferred. Never returns null.
Download all the listed files and folders from the main directory
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.
Download from a remote file to a local file
Download a file from the server and write the data into the given stream.
Reads data in chunks. Retries if server disconnects midway.
Setup a resume on failure of download
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 an implementation of IProgress to track upload progress.
Only files that pass all these rules are downloaded, and the files that don't pass are skipped.
Returns a listing of all the remote files, indicating if they were downloaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
Remove successfully downloaded files.
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.
The last byte index that should be downloaded, or 0 if the entire file should be downloaded.
If true then the file was downloaded, false otherwise.
Deletes the contents of the specified directory, without deleting the directory itself.
The full or relative path of the directorys contents to delete
Deletes the contents of the specified directory, without deleting the directory itself.
The full or relative path of the directorys contents to delete
Useful to delete hidden files or dot-files.
Executes a command
The command to execute
The servers reply to the command
Execute a custom FTP command and read the data channel to return its multiline output.
The command to issue which produces output
A list of string objects corresponding to the multi-line response by the server
Execute a custom FTP command and return its multiline output.
The command to issue which produces output
Retry the command execution on temporary failure?
Checks if a file exists on the server.
The full or relative path to the file
True if the file exists
Ensure a relative dir is absolute by prepending the working dir
Concat a path and a filename
Ensure a relative path is absolute by prepending the working dir
Retrieves a checksum of the given file using the specified checksum algorithm, or using the first available algorithm that the server supports.
The algorithm used goes in this order:
1. HASH command using the first supported algorithm.
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
Gets the hash of the specified file using the given command.
Sets the hash algorithm on the server to use for the HASH command.
Gets the hash of an object on the server using the currently selected hash algorithm.
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
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
Gets the size of a remote file, in bytes.
The full or relative path of the file
Value to return if there was an error obtaining the file size, or if the file does not exist
The size of the file, or defaultValue if there was a problem.
Gets the file size of an object, without locking
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.
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
Gets the modified time of a remote file.
The full path to the file
The modified time, or if there was a problem
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.
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
Retrieves a reply from the server.
Support "normal" mode waiting for a command reply, subject to timeout exception
and "exhaustNoop" mode, which waits for 10 seconds to collect out of band NOOP responses
FtpReply representing the response from the server
Gets the current working directory
The current working directory, ./ if the response couldn't be parsed.
If an FTP Server has "different realms", in which realm is the
current working directory.
The realm
Called during Connect(). Typically extended by FTP proxies.
Is the current working directory the root?
true if root.
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
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
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
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 the specified file for appending. Please call GetReply() after you have successfully transferred 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
Opens the specified file for appending. Please call GetReply() after you have successfully transferred 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
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
A stream for writing to the file on the server
Opens a data stream.
The command to execute that requires a data stream
Restart location in bytes for file transfer
The data stream.
Opens a FXP PASV connection between the source FTP Server and the destination FTP Server
FtpClient instance of the destination FTP Server
Provide an implementation of IProgress to track download progress.
A data stream ready to be used
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
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
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
A stream for reading the file on the server
Opens the specified file for writing. Please call GetReply() after you have successfully transferred 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
Opens the specified file for writing. Please call GetReply() after you have successfully transferred 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
Pass in a file length if known
-1 => File length is irrelevant, do not attempt to determine it
0 => File length is unknown, try to determine it
>0 => File length is KNOWN. No need to determine it
A stream for writing to the file on the server
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
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.
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 permissions in CHMOD format
Changes the modified time of a remote file
The full path to the file
The new modified date/time value
Sets the work directory on the server
The path of the directory to change to
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 transferred. Never returns null.
Make a list of files to transfer
Transfer each file
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 transferred.
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
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.
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 transferred. Never returns null.
Create all the sub directories within the main directory
Upload all the files within the main directory
Delete the extra remote files if in mirror mode and the directory was pre-existing
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 .
Upload a local file to a remote file
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.
Setup a resume on an upload failure
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 an implementation of IProgress to track upload progress.
Only files that pass all these rules are uploaded, and the files that don't pass are skipped.
Returns a listing of all the local files, indicating if they were uploaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
Remove successfully uploaded files.
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 an implementation of IProgress to track upload progress.
Only files that pass all these rules are uploaded, and the files that don't pass are skipped.
Returns a listing of all the local files, indicating if they were uploaded, skipped or overwritten.
Returns a blank list if nothing was transferred. Never returns null.
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.
Get a list of all the files that need to be uploaded
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.
Verify an FXP file transfer
Verify a file transfer
Interface for the AsyncFtpClient class.
For detailed documentation of the methods, please see the FtpClient class or check the Wiki on the FluentFTP Github project.
Base object for FtpClient, AsyncFtpClient and the internal client
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 (machine listings)
Supports the SIZE command (get file size)
Supports the MDTM command (get file date modified)
Supports download/upload stream resumes
Supports UTF8
PRET Command used by 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
PASV, EPSV, PORT, EPRT correspond directly to the "classic" FTP
connection types available on most "modern" FTP servers. These are
subject to the well known caveats and you might like to examine the
following enhanced alternatives:
AutoActive, AutoPassive are FluentFTP extensions to make a fallback
to the non-extended versions of EPSV and EPRT automatic if not supported.
PassiveExtended delivers the functionality of EPSV on servers that do not
support this command.
PassiveAllowUnroutable makes using PASV work inside local networks.
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.
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.
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.
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.
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.
Same as PASV except the host supplied by the server is used even
if the address is an unroutable address. Useful if you are connecting
to a server with the same private network.
Type of data transfer to do
ASCII transfer
Binary transfer
Not known yet
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
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.
Automatic algorithm, or hashing not supported.
SHA-1 algorithm
SHA-256 algorithm
SHA-512 algorithm
MD5 algorithm
CRC algorithm
IP Versions to allow when connecting
to a server.
Unknown protocol.
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
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.
Append is now renamed to Resume.
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
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
For setting up rules
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 z/OS
File listing parser for IBM OS/400.
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.
Resume uploading by appending to the remote 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.
Append the local file to the end of the remote 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.
Skip the file if it exists, without any more checks.
Overwrite the file if it exists.
Resume uploading by appending to the remote file if it exists.
It works by checking the remote file length and adding the missing data.
Append the local file to the end of the remote file.
Append is now renamed to Resume. Alternatively you can use AddToEnd.
The type of response the server responded with
No response
Success
Success
Success
Temporary failure
Permanent failure
Determines how SSL Buffering is handled
Enables SSL Buffering to massively speed up FTPS operations except when:
Under .NET 5.0 and later due to platform issues (see issue 682 in FluentFTP issue tracker).
On the control connection
For proxy connections
If NOOPs are configured to be used
Always disables SSL Buffering to reduce FTPS connectivity issues.
Same as "Auto"
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 Apache FTP server
Definitely BFTPd server
Definitely Cerberus FTP server
Definitely CrushFTP server
Definitely D-Link FTP server
Definitely FileZilla server
Definitely FritzBox FTP server
Definitely FTP2S3 gateway server
Definitely glFTPd server
Definitely GlobalScape EFT server
Definitely Homegate FTP server
Definitely Huawei Technologies HG5xxx series FTP server
Definitely IBM z/OS FTP server
Definitely IBM OS/400 FTP server
Definitely ABB IDAL FTP server
Definitely MikroTik RouterOS FTP server
Definitely HP NonStop/Tandem server
Definitely OpenVMS server
Definitely ProFTPD server
Definitely PureFTPd server
Definitely PyFtpdLib server
Definitely Rumpus server
Definitely Serv-U server
Definitely Sun OS Solaris FTP server
Definitely Titan FTP server
Definitely TP-LINK FTP server
Definitely VsFTPd server
Definitely Windows CE FTP server
Definitely Windows Server/IIS FTP server
Definitely WS_FTP server
Definitely WuFTPd server
Definitely XLight 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 transferring, or the source file did not exist
The upload or download completed successfully
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.
Flags that can control how a file listing is performed. If you are unsure what to use, set it to Auto.
Not z/OS Server
HFS / USS
z/OS classic dataset
Partitioned dataset member, RECFM != U
Partitioned dataset member, RECFM = U
SITE FILETYPE=JES LIST
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.
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
Setup the error message string
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 is thrown when the required hash algorithm is unsupported by the server.
Gets the unsupported hash algorithm
Default constructor
Algorithm-specific constructor
Must be implemented so every Serializer can Deserialize the Exception
Exception is thrown when TLS/SSL encryption could not be negotiated by the FTP server.
AuthenticationException that caused this.
Default constructor
Custom error message
Error message
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 FtpClient/AsyncFtpClient when the primary file or folder to be downloaded is missing.
Gets the 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.
Creates a new FtpMissingObjectException.
The original exception.
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
FtpProtocolUnsupportedException
FtpProtocolUnsupportedException
Error message
FtpProxyException
FtpProxyException
FtpProxyException
FtpProxyException
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
Check if operation can resume after .
Received exception.
Result of checking.
Extension methods related to FTP tasks
Checks if the array is null or 0 length.
Checks if the array is null or 0 length.
Converts the arguments to an array of strings.
Ensures the given item is only added once. If it was not present true is returned, else false is returned.
Shallow clones the list by copying each item to a new list.
Extension methods related to FTP date time values
Converts the FTP date string into a DateTime object, without performing any timezone conversion.
The date string
The client object this is done for
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
Generates C# code to create this 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, 4) full paths with invalid slashes
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
Helper class to convert FtpHashAlgorithm
Get FtpHashAlgorithm from its 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
Get the first supported algorithm, in the standard order of preference. If no hashing algos found, returns NONE.
Parses the received FTP hash response into a new FtpHash object.
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.
Get random local port for the given local IP address
Log a message to the given IFluentLogger class.
Get the log prefix for the given trace level type.
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
Checks if the given listing is a valid IBM z/OS file listing
Parses IBM z/OS format listings
The FTP client
A line from the listing
Current location
FtpListItem if the item is able to be parsed
Parses the last modified date from IBM z/OS format listings
Checks if the given listing is a valid Machine Listing item
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
Checks if the given path is a root directory or working directory path
Converts the specified path into a valid FTP file system path.
Replaces invalid back-slashes with valid forward-slashes.
Replaces multiple slashes with single slashes.
Removes the ending postfix slash if any.
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.
Supports paths with backslashes and forwardslashes.
The full path to the file
The file name
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, by checking in case-insensitive manner.
Checks if the string equals any of these values, by checking in case-sensitive manner.
Checks if the string contains the given substring in a case-insensitive manner.
Checks if the string starts with the given substring in a case-insensitive manner.
Checks if the string ends with the given substring in a case-insensitive manner.
Extension methods related to FTP time span values
Extension methods related to FTP tasks
Ensures that the URI points to a server, and not a directory or invalid path.
The current "state" of the client
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.
Cached value of the last read working directory (absolute path).
Cached value of the last set hash algorithm.
Did the FTPS connection fail during the last Connect/ConnectAsync attempt?
Did the UTF8 encoding setting work during the last Connect/ConnectAsync attempt?
Store the current data type setting
Allow checking for stale data on socket?
We are in a sequence of commands that should not be interrupted
by an automatic reconnect
Count the reconnects
Reset this value when a non-reconnect takes place
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.
Avoid repeated DNS queries for the same host name
During and after a z/OS GetListing(), this value stores the
z/OS filesystem realm that was encountered.
The value is used internally to control the list parse mode
During and after a z/OS GetListing(), this value stores the
the LRECL that was encountered (for a realm = Member only).
The value is used internally to calculate member sizes
Holds all the configuration settings for a single FTP client.
One FtpConfig object can only be bound to one client at a time.
If you want to reuse it across multiple FTP clients, then clone it and then reuse it.
Which FtpClient are we bound to?
Should the function calls be logged in Verbose mode?
Should the FTP server host IP/domain be shown in the logs (true) or masked out (false)?
Should the FTP username be shown in the logs (true) or masked out (false)?
Should the FTP password be shown in the logs (true) or masked out (false)?
Should the command duration be shown after each log command?
Flags specifying which versions of the internet protocol (IPV4 or IPV6) 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.
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. 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.
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.
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 0 (Use OS default timeout)
See: https://github.com/robinrodricks/FluentFTP/wiki/FTP-Connection#connection-timeout-settings
and: https://github.com/robinrodricks/FluentFTP/wiki/FTP-Connection#faq_timeoutwindows
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.
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 .
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 and later due to platform issues (see issue 682 in FluentFTP issue tracker).
Also disabled on the control connection, for proxy connections and if NOOPs are configured to be used
Gets or sets the max number of socket write/read transactions
before an automatic disconnect/reconnect is performed.
This is required to bypass an SSL issue that occurs after a specific number of transactions.
Set to zero to disable automatic reconnects.
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).
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 at the time of connection.
If you want to override this property, make sure to do it after calling Connect.
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
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.
Gets or sets the FileShare setting to be used when opening a FileReadStream for uploading to the server,
which needs to be set to FileShare.ReadWrite in special cases to avoid denied access.
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.
The local socket will be bound to the given local IP/interface.
This is useful if you have several usable public IP addresses and want to use a particular one.
Used to set a custom stream handler, for example to integrate with the `FluentFTP.GnuTLS` package.
Used to set the configuration for a custom stream handler, for example to integrate with the `FluentFTP.GnuTLS` package.
Bind this FtpConfig object to the given FTP client.
Return a deep clone of this FtpConfig object.
Copy settings from one config object to another.
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.
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().
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.
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
Returns a code representation of this object and its properties
Metadata of a single log message.
The current "profile" defining the client
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
If the server surely supports the given encoding.
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 current file being transferred.
Stores the absolute local path of the current file being transferred.
Stores the index of the file in the listing.
Only used when transferring multiple files or an entire directory.
Stores the total count of the files to be transferred.
Only used when transferring 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.
Connection profile for a proxy connection.
Proxy server host name. Mandatory.
Proxy server port. Mandatory.
Proxy server login credentials. Mandatory if your proxy needs authentication, leave it blank otherwise.
FTP server host name. Optional. You can either set it here or set `ftpClient.Host` later on.
FTP server port. Optional. You can either set it here or set `ftpClient.Port` later on.
FTP server login credentials. Optional. You can either set it here or set `ftpClient.Credentials` later on.
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, by checking the FTP status code.
1xx, 2xx, 3xx indicate success and 4xx, 5xx are failures.
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 command that produced this reply (if any)
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, or 0 if unknown.
Gets the name and extension of the file.
Stores the absolute remote path of the current file being transferred.
Stores the absolute local path of the current file being transferred.
Gets the error that occurring during transferring 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.
Human readable results
Reply from a SIZE command
The returned file size
The reply we got
Use a new cloned FtpClient for testing connection profiles (true) or use the source FtpClient (false)
Find all successful profiles (false) or stop after finding the first successful profile (true)
If true, then try the very rarely used Implicit FTP mode.
If true, then we will not try the insecure FTP unencrypted mode, and only try FTPS.
If false, then both FTP and FTPS will be tried.
List of protocols to be tried, and the order they should be tried in.
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
The token that can be used to cancel the entire process
Connects to the server using an existing
The existing socket stream
Host name
Port number
IP version to use
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.
Cancellation token.
A FTP client with a SOCKS4a proxy implementation.
Setup a SOCKS4a proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Called during . Typically extended by FTP proxies.
Connect
A FTP client with a SOCKS4 proxy implementation.
Setup a SOCKS4 proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Called during . Typically extended by FTP proxies.
Connect
A FTP client with a SOCKS5 proxy implementation.
Setup a SOCKS5 proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Connect
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
This class is not reusable.
You have to create a new instance for each connection / attempt.
This class is not reusable.
You have to create a new instance for each connection / attempt.
Translate the host name or IP address to a byte array.
Host name or IP address.
Byte array representing IP address in bytes.
Translate the destination port value to a byte array.
Destination port.
Byte array representing an 16 bit port number as two bytes.
This class is not reusable.
You have to create a new instance for each connection / attempt.
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 SOCKS4a proxy implementation.
Setup a SOCKS4a proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Called during Connect(). Typically extended by FTP proxies.
Connect
Connect
A FTP client with a SOCKS4 proxy implementation.
Setup a SOCKS4 proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Called during Connect(). Typically extended by FTP proxies.
Connect
Connect
A FTP client with a SOCKS5 proxy implementation.
Setup a SOCKS5 proxy
Creates a new instance of this class. Useful in FTP proxy classes.
Connect
Connect
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
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
Which path segment to start checking from
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.
Which path segment to start checking from. 0 checks root folder onwards. 1 skips root folder.
Checks if the FtpListItem Name does match any RegexPattern
Only accept folders that have the given name, or exclude folders of a given name.
Common folders to blacklist
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
Which path segment to start checking from
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
Which path segment to start checking from. 0 checks root folder onwards. 1 skips root folder.
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.
Rule object
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 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 async 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.
Perform async server-specific create directory commands here.
Return true if you executed a server-specific command.
Perform server-specific post-connection commands here.
Return true if you executed a server-specific command.
Perform server-specific post-connection commands here.
Return true if you executed a server-specific command.
Return true if your server requires custom handling of file size.
Perform server-specific file size fetching commands here.
Return the file size in bytes.
Perform server-specific file size fetching commands here.
Return the file size in bytes.
Check if the given path is a root directory on your FTP server.
If you are unsure, return false.
Skip reporting a parser error
Always read to end of stream on a download
If you are unsure, return false.
Return true if the path is an absolute path according to your server's convention.
Return true if your server requires custom handling of absolute paths.
Perform server-specific path modification here.
Return the absolute path.
Perform server-specific path modification here.
Return the absolute path.
Return true if your server requires custom handling of absolute dir.
Perform server-specific path modification here.
Return the absolute dir.
Perform server-specific path modification here.
Return the absolute path.
Return true if your server requires custom handling of path and filename concatenation.
Perform server-specific path modification here.
Return concatenation of path and filename
Perform server-specific path modification here.
Return concatenation of path and filename
Return true if your server requires custom handling to handle listing analysis.
Get the full path of a given FTP Listing entry
Return null indicates custom code decided not to handle this
Disable SIZE command even if server says it is supported
Disable MDTM command even if server says it is supported
Return true if your server requires custom handling to check file existence.
Check for existence of a file
Return null indicates custom code decided not to handle this
Check for existence of a file
Return null indicates custom code decided not to handle this
Server-specific handling for Apache (MINA) 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.
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 D-Link 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 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 Huawei 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 IBMOS400FTP 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 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.
Perform server-specific post-connection commands here.
Return true if you executed a server-specific command.
Perform server-specific post-connection commands here.
Return true if you executed a server-specific command.
Get z/OS file size
The client object this is being done for
The full path of the file whose size you want to retrieve
Make sure you are in the right realm (z/OS or HFS) before doing this
The size of the file
Get z/OS file size
The client object this is being done for
The full path of the file whose size you want to retrieve
The token that can be used to cancel the entire process
Make sure you are in the right realm (z/OS or HFS) before doing this
The size of the file
Check if the given path is a root directory on your FTP server.
If you are unsure, return false.
Skip reporting a parser error
Always read to End of stream on a download
Return true if your server requires custom handling of absolute path.
Perform server-specific path modification here.
Return the absolute path.
Perform server-specific path modification here.
Return the absolute path.
Return true if your server requires custom handling of absolute dir.
Perform server-specific path modification here.
Return null indicates custom code decided not to handle this
Return the absolute dir.
Perform server-specific path modification here.
Return null indicates custom code decided not to handle this
Return the absolute dir.
Return true if your server requires custom handling of path and filename concatenation.
Perform server-specific path modification here.
Return null indicates custom code decided not to handle this
Return concatenation of path and filename
Perform server-specific path modification here.
Return null indicates custom code decided not to handle this
Return concatenation of path and filename
Return true if your server requires custom handling to handle listing analysis.
Get the full path of a given FTP Listing entry
Return null indicates custom code decided not to handle this
Disable SIZE command even if server says it is supported
Disable MDTM command even if server says it is supported
Return true if your server requires custom handling to check file existence.
Check for existence of a file
Return null indicates custom code decided not to handle this
Check for existence of a file
Return null indicates custom code decided not to handle this
Server-specific handling for ABB IDAL 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 MikroTik RouterOS 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 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.
Get the full path of a given FTP Listing entry
Return null indicates custom code decided not to handle this
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 async 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.
Perform async 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 PyFtpdLib 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 Rumpus 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 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.
Perform async 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 Titan 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 TP-LINK 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 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
Reads data off the stream asynchronously
The buffer to read into
Where to start in the buffer
Number of bytes to read
The cancellation token for this task
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
Writes data to the stream asynchronously
The buffer to write to the stream
Where to start in the buffer
The number of bytes to write to the buffer
The for this task
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
Stream object for the local files
Returns the file size using synchronous file I/O.
Returns the file size using async file I/O.
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.
FtpSslStream is an SslStream that properly sends a close_notify message when closing
the connection. This is required per RFC 5246 to avoid truncation attacks.
For more information, see https://tools.ietf.org/html/rfc5246#section-7.2.1
Inspired by: https://stackoverflow.com/questions/237807/net-sslstream-doesnt-close-tls-connection-properly/22626756#22626756
See: https://learn.microsoft.com/en-us/windows/win32/secauthn/shutting-down-an-schannel-connection
See: https://learn.microsoft.com/en-us/windows/win32/secauthn/using-sspi-with-a-windows-sockets-client?source=recommendations
Note:
Here is a quote from: https://github.com/dotnet/standard/issues/598#issuecomment-352148072
"The SslStream.ShutdownAsync API was added to .NET Core 2.0. It was also added to .NET Framework 4.7.
Logically, since .NET Core 2.0 and .NET Framework 4.7.1 are aligned with NETStandard2.0, it could
have been part of the NETStandard20 definition. But it wasn't due to when the NETStandard2.0 spec
was originally designed."
Note:
Microsoft says we should not override close():
"Place all cleanup logic for your stream object in Dispose(Boolean). Do not override Close()."
See: https://learn.microsoft.com/en-us/dotnet/api/system.io.stream.dispose?view=net-7.0
But: We recently changed the below logic due to issue #1107, which solved the problem in part
Create an SslStream object
Close
For representing this SslStream in the log
Reflection hack to issue an SSL Close Notify Alert to cleanly shutdown an SSL session
Valid only on .NET Framework
Stream class used for talking. Used by FtpClient, extended by FtpDataStream
The non-encrypted stream
The client this stream is associated with
This stream connection to be associated with this client
Used for tracking 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
Keep a count of command/response transactions on the
control connection
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
Is this stream the control connection?
The negotiated SSL/TLS protocol version. Will have a valid value after connection is complete.
Gets the underlying stream, could be a NetworkStream, SslStream or CustomStream
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 0 = disable, use system default timeout.
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
Fires the SSL certificate validation event for custom encrypted streams
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
Flushes the stream asynchronously
The for this task
Bypass the stream and read directly off the socket.
The buffer to read into
The number of bytes read
Bypass the stream and read directly off the socket.
The buffer to read into
The token that can be used to cancel the entire process
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 data from the stream
Buffer to read into
Where in the buffer to start
Number of bytes to be read
The for this task
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
Reads a line from the socket asynchronously
The type of encoding used to convert from byte[] to string
The for this task
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
The token that can be used to cancel the entire process
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 written
Writes data to the stream asynchronously
Buffer to write to stream
Where in the buffer to start
Number of bytes to be written
The for this task
Writes a line to the stream using the specified encoding
Encoding used for writing the line
The data to write
Writes a line to the stream using the specified encoding asynchronously
Encoding used for writing the line
The data to write
The for this task
Disconnects from server
Safely close the socket if its open
Sets socket options on the underlying socket
SocketOptionLevel
SocketOptionName
SocketOptionValue
Check if the specified IP Address is allowed
The ip address to connect to
The enum value of allowed IP Versions
Textual representation of the address family
Get the IP Address(es) associated with this host
The host to query
Set the connected IP Address associated with this host
The host to query
The IP address to store in the cache
Connect to the specified host
The host to connect to
The port to connect to
Internet Protocol versions to support during the connection phase
Connect to the specified host
Detects timeout and throws that explicitly
The ip address to connect to
The port to connect to
Get the IP Address(es) associated with this host
The host to query
The token that can be used to cancel the entire process
Connect to the specified host
The host to connect to
The port to connect to
Internet Protocol versions to support during the connection phase
The token that can be used to cancel the entire process
Connect to the specified host
Detects timeout and throws that explicitly
The ip address to connect to
The port to connect to
The token that can be used to cancel the entire process
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
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.
The token that can be used to cancel the entire process
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.
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
Accepts a connection from a listening socket