NET SFTP Library
OverwriteFiles Property
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : OverwriteFiles Property
If a file already exists locally it will be overwritten during a download. The default for this property is false.
Syntax
'Declaration
 
Public Property OverwriteFiles As System.Boolean
'Usage
 
Dim instance As SFTP
Dim value As System.Boolean
 
instance.OverwriteFiles = value
 
value = instance.OverwriteFiles
public System.bool OverwriteFiles {get; set;}
public read-write property OverwriteFiles: System.Boolean; 
public function get,set OverwriteFiles : System.boolean
public: __property System.bool get_OverwriteFiles();
public: __property void set_OverwriteFiles( 
   System.bool value
);
public:
property System.bool OverwriteFiles {
   System.bool get();
   void set (    System.bool value);
}
Example
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SSH server( its URL )
sftp.HostAddress = "some.sftp.server.com"; // replace with your SFTP server
sftp.UserName  = "anonymous"; // replace with your user name
sftp.Password = "user@mail.com"; // replace with your password
 
//If a file already exists locally it will be overwritten durring a download 
sftp.OverwriteFiles = true;
System.Console.WriteLine("A file that already exist will {0} durring a download ", sftp.OverwriteFiles == true ? "be overwritten" : "not be overwritten");
 
sftp.DownloadFile("a.txt", "a.txt");
Dim sftp As SFTP = New SFTP() 'Trial Mode
'Dim sftp As SFTP = New SFTP("place user name here", "place license key here");
 
' set the name of the SSH server( its URL )
sftp.HostAddress = "some.sftp.server.com" ' replace with your SFTP server
sftp.UserName  = "anonymous" ' replace with your user name
sftp.Password = "user@mail.com" ' replace with your password
 
'If a file already exists locally it will be overwritten durring a download 
sftp.OverwriteFiles = True
If sftp.OverwriteFiles = True Then
    System.Console.WriteLine("A file that already exist will {0} durring a download ","be overwritten")
Else
    System.Console.WriteLine("A file that already exist will {0} durring a download ","not be overwritten")
End If
 
sftp.DownloadFile("a.txt", "a.txt")
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SFTP Class
SFTP Members