NET FTP Library
SiteToSiteDirectorySynchronizationAsync Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP Class : SiteToSiteDirectorySynchronizationAsync Method
Synchronize specified by name directory on current FTP and destination FTP asynchronously.
Syntax
'Declaration
 
Public Sub SiteToSiteDirectorySynchronizationAsync( _
   ByVal destination As FTP, _
   ByVal ftpDirectory As System.String _
) 
'Usage
 
Dim instance As FTP
Dim destination As FTP
Dim ftpDirectory As System.String
 
instance.SiteToSiteDirectorySynchronizationAsync(destination, ftpDirectory)
public void SiteToSiteDirectorySynchronizationAsync( 
   FTP destination,
   System.string ftpDirectory
)
public procedure SiteToSiteDirectorySynchronizationAsync( 
    destination: FTP;
    ftpDirectory: System.String
); 
public function SiteToSiteDirectorySynchronizationAsync( 
   destination : FTP,
   ftpDirectory : System.String
);
public: void SiteToSiteDirectorySynchronizationAsync( 
   FTP* destination,
   System.string* ftpDirectory
) 
public:
void SiteToSiteDirectorySynchronizationAsync( 
   FTP^ destination,
   System.String^ ftpDirectory
) 

Parameters

destination
ftpDirectory
Example
//Connect to the source
FTP ftpSource = new FTP();
ftpSource.HostAddress = "source host address";
ftpSource.UserName = "source user name";
ftpSource.Password = "source password";
ftpSource.EnableLogging();
ftpSource.Connect();
 
//Create a source directory on the source FTP server
ftpSource.CreateDirectory("/SourceDir/Test");
ftpSource.CurrentDirectory = "/SourceDir/Test";
 
//Create a test file and upload two files to the source directory
File.WriteAllText("test1.txt", "This is test 1");
ftpSource.UploadFile("test1.txt", "test1.txt");
 
File.WriteAllText("test2.txt", "This is test 2");
ftpSource.UploadFile("test2.txt", "test2.txt");
 
ftpSource.CurrentDirectory = "/SourceDir";
 
//Connect to the destination
FTP ftpDest = new FTP();
ftpDest.HostAddress = "dest host address";
ftpDest.UserName = "dest user name";
ftpDest.Password = "dest password";
ftpDest.EnableLogging();
ftpDest.Connect();
 
//Create a dest directory on the dest FTP server
ftpDest.CreateDirectory("DestDir/Test");
ftpDest.CurrentDirectory = "DestDir";
 
ftpSource.SiteToSiteDirectorySynchronization(ftpDest, "Test");
 
if (ftpDest.FileExists("test1.txt") && ftpDest.FileExists("test2.txt"))
    Console.WriteLine("Success!");
'Connect to the source
Dim ftpSource As New FTP()
ftpSource.HostAddress = "source host address"
ftpSource.UserName = "source user name"
ftpSource.Password = "source password"
ftpSource.EnableLogging()
ftpSource.Connect()
 
'Create a source directory on the source FTP server
ftpSource.CreateDirectory("/SourceDir/Test")
ftpSource.CurrentDirectory = "/SourceDir/Test"
 
'Create a test file and upload two files to the source directory
File.WriteAllText("test1.txt", "This is test 1")
ftpSource.UploadFile("test1.txt", "test1.txt")
 
File.WriteAllText("test2.txt", "This is test 2")
ftpSource.UploadFile("test2.txt", "test2.txt")
 
ftpSource.CurrentDirectory = "/SourceDir"
 
'Connect to the destination
Dim ftpDest As New FTP()
ftpDest.HostAddress = "dest host address"
ftpDest.UserName = "dest user name"
ftpDest.Password = "dest password"
ftpDest.EnableLogging()
ftpDest.Connect()
 
'Create a dest directory on the dest FTP server
ftpDest.CreateDirectory("DestDir/Test")
ftpDest.CurrentDirectory = "DestDir"
 
ftpSource.SiteToSiteDirectorySynchronization(ftpDest, "Test")
 
If ftpDest.FileExists("test1.txt") AndAlso ftpDest.FileExists("test2.txt") Then
    Console.WriteLine("Success!")
End If
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