PowerTCP FTP for .NET
StoreType Enumeration
Example Example 



Enumerates how to treat a stored file when a file exists with the same name.
Syntax
Public Enum StoreType 
   Inherits System.Enum
Dim instance As StoreType
public enum StoreType : System.Enum 
public enum class StoreType : public System.Enum 
Members
MemberDescription
Append If an existing file is present, append the stored file to it.
Replace Over-write any existing file.
Unique If an existing file is present, store the file using a unique name.
Remarks

This enumeration is used by the Ftp.Put methods, specifying the action to take when a file is put to the server and there is an existing file with the same name. Use StoreType.Replace to overwrite the existing file, StoreType.Append to add the new file to the end of the existing file, and StoreType.Unique to store the file with a unique name. The unique name will be returned in the response.

Example
The following example demonstrates appending a local file to a remote file.
/// <summary>
/// Appends the specified local file to the remote file
/// </summary>
/// <param name="myFtp">A connected and authenticated Ftp instance</param>
/// <param name="localPath">Path to the local file</param>
/// <param name="remotePath">An absolute or relative path to the file on the server</param>
/// <returns>The CopyResult of the operation</returns>
public CopyResult AppendFile(Ftp myFtp, string localPath, string remotePath)
{
    //Open the local file
    using (FileStream fs = File.OpenRead(localPath))
    {
        //Append the local file to the destination, and (optionally) return the result
        return myFtp.Put(fs, remotePath, 0, StoreType.Append);
    }
}
''' <summary>
''' Appends the specified local file to the remote file
''' </summary>
''' <param name="myFtp">A connected and authenticated Ftp instance</param>
''' <param name="localPath">Path to the local file</param>
''' <param name="remotePath">An absolute or relative path to the file on the server</param>
''' <returns>The CopyResult of the operation</returns>
Public Function AppendFile(ByVal myFtp As Ftp, ByVal localPath As String, ByVal remotePath As String) As CopyResult
    'Open the local file
    Using fs As FileStream = File.OpenRead(localPath)
        'Append the local file to the destination, and (optionally) return the result
        Return myFtp.Put(fs, remotePath, 0, StoreType.Append)
    End Using
End Function
Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         Dart.Ftp.StoreType

See Also

Reference

Dart.Ftp Namespace


PowerTCP FTP for .NET Documentation Version 6.1
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic