NET SFTP Library
SiteToSiteDirectorySynchronizationAsync Method
Example 






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

Parameters

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

SFTP Class
SFTP Members