NET SFTP Library
OverwriteReadOnlyFiles Property
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : OverwriteReadOnlyFiles Property
If a local file is a read only file it will be overwritten durring a download. The default for this property is false.
Syntax
'Declaration
 
Public Property OverwriteReadOnlyFiles As System.Boolean
'Usage
 
Dim instance As SFTP
Dim value As System.Boolean
 
instance.OverwriteReadOnlyFiles = value
 
value = instance.OverwriteReadOnlyFiles
public System.bool OverwriteReadOnlyFiles {get; set;}
public read-write property OverwriteReadOnlyFiles: System.Boolean; 
public function get,set OverwriteReadOnlyFiles : System.boolean
public: __property System.bool get_OverwriteReadOnlyFiles();
public: __property void set_OverwriteReadOnlyFiles( 
   System.bool value
);
public:
property System.bool OverwriteReadOnlyFiles {
   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 local file is a read only file it will be overwritten durring a download 
sftp.OverwriteReadOnlyFiles = false;
System.Console.WriteLine("A readonly file that already exist will {0} durring a download ", sftp.OverwriteReadOnlyFiles == 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 local file is a read only file it will be overwritten durring a download 
sftp.OverwriteReadOnlyFiles = False
If sftp.OverwriteReadOnlyFiles = True Then
    System.Console.WriteLine("A readonly file that already exist will {0} durring a download ","be overwritten")
Else
    System.Console.WriteLine("A readonly 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