FtpClient Methods

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image

The FtpClient type exposes the following members.

Methods

  Name Description
Protected method Authenticate
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.
Public method BeginConnect
Initiates a connection to the server
Public method BeginCreateDirectory(String, AsyncCallback, Object)
Creates a directory asynchronously
Public method BeginCreateDirectory(String, Boolean, AsyncCallback, Object)
Creates a directory asynchronously
Public method BeginDeleteDirectory(String, AsyncCallback, Object)
Asynchronously removes a directory from the server
Public method BeginDeleteDirectory(String, Boolean, AsyncCallback, Object)
Asynchronously removes a directory from the server
Public method BeginDeleteDirectory(String, Boolean, FtpListOption, AsyncCallback, Object)
Asynchronously removes a directory from the server
Public method BeginDeleteFile
Asynchronously deletes a file from the server
Public method BeginDereferenceLink(FtpListItem, AsyncCallback, Object)
Derefence a FtpListItem object asynchronously. See the MaximumDereferenceCount property for controlling how deep this method will recurse before giving up.
Public method BeginDereferenceLink(FtpListItem, Int32, AsyncCallback, Object)
Derefence a FtpListItem object asynchronously
Public method BeginDirectoryExists
Checks if a directory exists on the server asynchronously.
Public method BeginDisconnect
Initiates a disconnection on the server
Public method BeginExecute
Performs an asynchronouse execution of the specified command
Public method BeginFileExists(String, AsyncCallback, Object)
Checks if a file exsts on the server by taking a file listing of the parent directory in the path and comparing the results the path supplied.
Public method BeginFileExists(String, FtpListOption, AsyncCallback, Object)
Checks if a file exsts on the server by taking a file listing of the parent directory in the path and comparing the results the path supplied.
Public method BeginGetFileSize
Asynchronously retrieve the size of the specified file
Public method BeginGetHash
Asynchronously retrieves the hash for the specified file
Public method BeginGetHashAlgorithm
Asynchronously get the hash algorithm being used by the HASH command.
Public method BeginGetListing(AsyncCallback, Object)
Gets a file listing from the server asynchronously
Public method BeginGetListing(String, AsyncCallback, Object)
Gets a file listing from the server asynchronously
Public method BeginGetListing(String, FtpListOption, AsyncCallback, Object)
Gets a file listing from the server asynchronously
Public method BeginGetModifiedTime
Gets the modified time of the file
Public method BeginGetNameListing(AsyncCallback, Object)
Asynchronously gets a list of file and directory names for the specified path.
Public method BeginGetNameListing(String, AsyncCallback, Object)
Asynchronously gets a list of file and directory names for the specified path.
Public method BeginGetWorkingDirectory
Asynchronously retrieves the working directory
Public method BeginOpenAppend(String, AsyncCallback, Object)
Opens the specified file for writing
Public method BeginOpenAppend(String, FtpDataType, AsyncCallback, Object)
Opens the specified file for writing
Public method BeginOpenRead(String, AsyncCallback, Object)
Opens the specified file for reading
Public method BeginOpenRead(String, Int64, AsyncCallback, Object)
Opens the specified file for reading
Public method BeginOpenRead(String, FtpDataType, AsyncCallback, Object)
Opens the specified file for reading
Public method BeginOpenRead(String, FtpDataType, Int64, AsyncCallback, Object)
Opens the specified file for reading
Public method BeginOpenWrite(String, AsyncCallback, Object)
Opens the specified file for writing
Public method BeginOpenWrite(String, FtpDataType, AsyncCallback, Object)
Opens the specified file for writing
Public method BeginRename
Asynchronously renames an object on the server
Protected method BeginSetDataType
Asynchronously sets the data type on the server
Public method BeginSetHashAlgorithm
Asynchronously sets the hash algorithm type to be used with the HASH command.
Public method BeginSetWorkingDirectory
Asynchronously changes the working directory on the server
Public method Connect()()()()
Connect to the server. Throws ObjectDisposedException if this object has been disposed.
Public method Static member Connect(Uri)
Connects to the specified URI. If the path specified by the URI ends with a / then the working directory is changed to the path specified.
Public method Static member Connect(Uri, Boolean)
Connects to the specified URI. If the path specified by the URI ends with a / then the working directory is changed to the path specified.
Public method CreateDirectory(String)
Creates a directory on the server. If the preceding directories do not exist they are created.
Public method CreateDirectory(String, Boolean)
Creates a directory on the server
Public method DeleteDirectory(String)
Deletes the specified directory on the server.
Public method DeleteDirectory(String, Boolean)
Delets the specified directory on the server
Public method DeleteDirectory(String, Boolean, FtpListOption)
Deletes the specified directory on the server
Public method DeleteFile
Deletes a file on the server
Public method DereferenceLink(FtpListItem)
Recursively dereferences a symbolic link. See the MaximumDereferenceCount property for controlling how deep this method will recurse before giving up.
Public method DereferenceLink(FtpListItem, Int32)
Recursively dereferences a symbolic link
Public method DirectoryExists
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.
Public method DisableUTF8
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.
Public method Disconnect
Disconnect from the server
Public method Dispose
Disconnects from the server, releases resources held by this object.
Public method EndConnect
Ends an asynchronous connection attempt to the server
Public method EndCreateDirectory
Ends a call to BeginCreateDirectory
Public method EndDeleteDirectory
Ends a call to BeginDeleteDirectory()
Public method EndDeleteFile
Ends a call to BeginDeleteFile
Public method EndDereferenceLink
Ends a call to BeginDereferenceLink
Public method EndDirectoryExists
Ends a call to BeginDirectoryExists
Public method EndDisconnect
Ends a call to BeginDisconnect
Public method EndExecute
Ends an asynchronous command
Public method EndFileExists
Ends a call to BeginFileExists
Public method EndGetFileSize
Ends a call to BeginGetFileSize()
Public method EndGetHash
Ends an asynchronous call to BeginGetHash
Public method EndGetHashAlgorithm
Ends a call to BeginGetHashAlgorithm
Public method EndGetListing
Ends an asynchronous file listing
Public method EndGetModifiedTime
Ends a call to BeginGetModifiedTime()
Public method EndGetNameListing
Ends a call to BeginGetNameListing()
Public method EndGetWorkingDirectory
Ends an asynchronous call to retrieve the working directory
Public method EndOpenAppend
Ends a call to BeginOpenAppend()
Public method EndOpenRead
Ends a call to BeginOpenRead()
Public method EndOpenWrite
Ends a call to BeginOpenWrite()
Public method EndRename
Ends a call to BeginRename
Protected method EndSetDataType
Ends a call to BeginSetDataType()
Public method EndSetHashAlgorithm
Ends an asynchronous call to BeginSetHashAlgorithm
Public method EndSetWorkingDirectory
Ends asynchronous directory change
Public method Equals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public method Execute(String)
Executes a command
Public method Execute(String, array<Object>[]()[][])
Executes a command
Public method FileExists(String)
Checks if a file exsts on the server by taking a file listing of the parent directory in the path and comparing the results the path supplied.
Public method FileExists(String, FtpListOption)
Checks if a file exsts on the server by taking a file listing of the parent directory in the path and comparing the results the path supplied.
Protected method Finalize
Finalizer
(Overrides Object..::..Finalize()()()().)
Protected method GetAsyncDelegate<(Of <<'(T>)>>)
Retretieves the delegate for the specified IAsyncResult and removes it from the m_asyncmethods collection if the operation is successfull
Protected method GetFeatures
Populates the capabilities flags based on capabilities supported by this server. This method is overridable so that new features can be supported
Public method GetFileSize
Gets the size of the file
Public method GetHash
Gets the hash of an object on the server using the currently selected hash algorithm. Supported algorithms, if any, are available in the HashAlgorithms property. You should confirm that it's not equal to FtpHashAlgorithm.NONE before calling this method otherwise the server trigger a FtpCommandException() due to a lack of support for the HASH command. You can set the algorithm using the SetHashAlgorithm() method and you can query the server for the current hash algorithm using the GetHashAlgorithm() method. This feature is experimental and based on the following draft: http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Public method GetHashAlgorithm
Gets the currently selected hash algorith for the HASH command. This feature is experimental. See this link for details: http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Public method GetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public method GetListing()()()()
Gets a file listing from the server. Each FtpListItem object returned contains information about the file that was able to be retrieved. If a DateTime property is equal to DateTime.MinValue then it means the date in question was not able to be retrieved. If the Size property is equal to 0 then it means the size of the object could also not be retrieved.
Public method GetListing(String)
Gets a file listing from the server. Each FtpListItem object returned contains information about the file that was able to be retrieved. If a DateTime property is equal to DateTime.MinValue then it means the date in question was not able to be retrieved. If the Size property is equal to 0 then it means the size of the object could also not be retrieved.
Public method GetListing(String, FtpListOption)
Gets a file listing from the server. Each FtpListItem object returned contains information about the file that was able to be retrieved. If a DateTime property is equal to DateTime.MinValue then it means the date in question was not able to be retrieved. If the Size property is equal to 0 then it means the size of the object could also not be retrieved.
Public method GetModifiedTime
Gets the modified time of the file
Public method GetNameListing()()()()
Returns a file/directory listing using the NLST command.
Public method GetNameListing(String)
Returns a file/directory listing using the NLST command.
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public method GetWorkingDirectory
Gets the current working directory
Public method HasFeature
Performs a bitwise and to check if the specified flag is set on the Capabilities enum property.
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public method OpenAppend(String)
Opens the specified file to be appended to
Public method Static member OpenAppend(Uri)
Opens a stream to the file specified by the URI
Public method OpenAppend(String, FtpDataType)
Opens the specified file to be appended to
Public method Static member OpenAppend(Uri, Boolean)
Opens a stream to the file specified by the URI
Public method Static member OpenAppend(Uri, Boolean, FtpDataType)
Opens a stream to the file specified by the URI
Public method OpenRead(String)
Opens the specified file for reading
Public method Static member OpenRead(Uri)
Opens a stream to the file specified by the URI
Public method OpenRead(String, Int64)
Opens the specified file for reading
Public method OpenRead(String, FtpDataType)
Opens the specified file for reading
Public method Static member OpenRead(Uri, Boolean)
Opens a stream to the file specified by the URI
Public method OpenRead(String, FtpDataType, Int64)
Opens the specified file for reading
Public method Static member OpenRead(Uri, Boolean, FtpDataType)
Opens a stream to the file specified by the URI
Public method Static member OpenRead(Uri, Boolean, FtpDataType, Int64)
Opens a stream to the file specified by the URI
Public method OpenWrite(String)
Opens the specified file for writing
Public method Static member OpenWrite(Uri)
Opens a stream to the file specified by the URI
Public method OpenWrite(String, FtpDataType)
Opens the specified file for writing
Public method Static member OpenWrite(Uri, Boolean)
Opens a stream to the file specified by the URI
Public method Static member OpenWrite(Uri, Boolean, FtpDataType)
Opens a stream to the file specified by the URI
Public method Rename
Renames an object on the remote file system.
Protected method SetDataType
Sets the data type of information sent over the data stream
Public method SetHashAlgorithm
Tells the server which hash algorith to use for the HASH command. If you specifiy an algorithm not listed in FtpClient.HashTypes a NotImplemented() exectpion will be thrown so be sure to query that list of Flags before selecting a hash algorithm. Support for the HASH command is experimental. Please see the following link for more details: http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Public method SetWorkingDirectory
Sets the work directory on the server
Public method ToString
Returns a String that represents the current Object.
(Inherited from Object.)

Extension Methods

  Name Description
Public Extension Method BeginGetChecksum
Asynchronusly retrieve a checksum of the specified file. This feature is non-standard.
(Defined by ChecksumExtension.)
Public Extension Method BeginGetMD5
Asynchronusly retrieve a MD5 hash. The MD5 command is non-standard and not guaranteed to work.
(Defined by MD5.)
Public Extension Method BeginGetXCRC
Asynchronusly retrieve a CRC hash. The XCRC command is non-standard and not guaranteed to work.
(Defined by XCRC.)
Public Extension Method BeginGetXMD5
Asynchronusly retrieve a MD5 hash. The XMD5 command is non-standard and not guaranteed to work.
(Defined by XMD5.)
Public Extension Method BeginGetXSHA1
Asynchronusly retrieve a SHA1 hash. The XSHA1 command is non-standard and not guaranteed to work.
(Defined by XSHA1.)
Public Extension Method BeginGetXSHA256
Asynchronusly retrieve a SHA256 hash. The XSHA256 command is non-standard and not guaranteed to work.
(Defined by XSHA256.)
Public Extension Method BeginGetXSHA512
Asynchronusly retrieve a SHA512 hash. The XSHA512 command is non-standard and not guaranteed to work.
(Defined by XSHA512.)
Public Extension Method GetChecksum
Retrieves a checksum of the given file using a checksumming method that the server supports, if any. The algorithm used goes in this order: 1. HASH command; server preferred algorithm. See FtpClient.SetHashAlgorithm() 2. MD5 / XMD5 commands 3. XSHA1 command 4. XSHA256 command 5. XSHA512 command 6. XCRC command
(Defined by ChecksumExtension.)
Public Extension Method GetMD5
Gets the MD5 hash of the specified file using MD5. This is a non-standard extension to the protocol and may or may not work. A FtpCommandException will be thrown if the command fails.
(Defined by MD5.)
Public Extension Method GetXCRC
Get the CRC value of the specified file. This is a non-standard extension of the protocol and may throw a FtpCommandException if the server does not support it.
(Defined by XCRC.)
Public Extension Method GetXMD5
Gets the MD5 hash of the specified file using XMD5. This is a non-standard extension to the protocol and may or may not work. A FtpCommandException will be thrown if the command fails.
(Defined by XMD5.)
Public Extension Method GetXSHA1
Gets the SHA-1 hash of the specified file using XSHA1. This is a non-standard extension to the protocol and may or may not work. A FtpCommandException will be thrown if the command fails.
(Defined by XSHA1.)
Public Extension Method GetXSHA256
Gets the SHA-256 hash of the specified file using XSHA256. This is a non-standard extension to the protocol and may or may not work. A FtpCommandException will be thrown if the command fails.
(Defined by XSHA256.)
Public Extension Method GetXSHA512
Gets the SHA-512 hash of the specified file using XSHA512. This is a non-standard extension to the protocol and may or may not work. A FtpCommandException will be thrown if the command fails.
(Defined by XSHA512.)

See Also