NET FTP Library
OverwriteFiles Property
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP 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 Overridable Property OverwriteFiles As System.Boolean
'Usage
 
Dim instance As FTP
Dim value As System.Boolean
 
instance.OverwriteFiles = value
 
value = instance.OverwriteFiles
public virtual System.bool OverwriteFiles {get; set;}
public read-write property OverwriteFiles: System.Boolean; virtual; 
public function get,set OverwriteFiles : System.boolean
public: __property virtual System.bool get_OverwriteFiles();
public: __property virtual void set_OverwriteFiles( 
   System.bool value
);
public:
virtual property System.bool OverwriteFiles {
   System.bool get();
   void set (    System.bool value);
}
Example
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
//If a file already exists locally it will be overwritten durring a download 
ftp.OverwriteFiles = true;
System.Console.WriteLine("A file that already exist will {0} durring a download ", ftp.OverwriteFiles == true ? "be overwritten" : "not be overwritten");
 
ftp.DownloadFile("a.txt", "a.txt");
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
'If a file already exists locally it will be overwritten durring a download 
ftp.OverwriteFiles = True
If ftp.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
 
ftp.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

FTP Class
FTP Members