NET SFTP Library
UploadDirectoryInParallelAsync Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : UploadDirectoryInParallelAsync Method
The local path to put the directory
The SFTP directory to download
Download a directory and all sub directories in parallel using two threads and two SFTP connections
Syntax
'Declaration
 
<System.Runtime.CompilerServices.AsyncStateMachineAttribute(KellermanSoftware.NetSFtpLibrary.SFTP/d__228)>
<System.Diagnostics.DebuggerStepThroughAttribute()>
Public Function UploadDirectoryInParallelAsync( _
   ByVal localDirectory As System.String, _
   ByVal sftpDirectory As System.String _
) As System.Threading.Tasks.Task(Of List(Of TransferInfo))
'Usage
 
Dim instance As SFTP
Dim localDirectory As System.String
Dim sftpDirectory As System.String
Dim value As System.Threading.Tasks.Task(Of List(Of TransferInfo))
 
value = instance.UploadDirectoryInParallelAsync(localDirectory, sftpDirectory)
[System.Runtime.CompilerServices.AsyncStateMachine(KellermanSoftware.NetSFtpLibrary.SFTP/d__228)]
[System.Diagnostics.DebuggerStepThrough()]
public System.Threading.Tasks.Task<List<TransferInfo>> UploadDirectoryInParallelAsync( 
   System.string localDirectory,
   System.string sftpDirectory
)
public function UploadDirectoryInParallelAsync( 
    localDirectory: System.String;
    sftpDirectory: System.String
): System.Threading.Tasks.Task; 
System.Runtime.CompilerServices.AsyncStateMachineAttribute(KellermanSoftware.NetSFtpLibrary.SFTP/d__228)
System.Diagnostics.DebuggerStepThroughAttribute()
public function UploadDirectoryInParallelAsync( 
   localDirectory : System.String,
   sftpDirectory : System.String
) : System.Threading.Tasks.Task;
[System.Runtime.CompilerServices.AsyncStateMachine(KellermanSoftware.NetSFtpLibrary.SFTP/d__228)]
[System.Diagnostics.DebuggerStepThrough()]
public: System.Threading.Tasks.Task<List<TransferInfo*>*>* UploadDirectoryInParallelAsync( 
   System.string* localDirectory,
   System.string* sftpDirectory
) 
[System.Runtime.CompilerServices.AsyncStateMachine(KellermanSoftware.NetSFtpLibrary.SFTP/d__228)]
[System.Diagnostics.DebuggerStepThrough()]
public:
System.Threading.Tasks.Task<List<TransferInfo^>^>^ UploadDirectoryInParallelAsync( 
   System.String^ localDirectory,
   System.String^ sftpDirectory
) 

Parameters

localDirectory
The local path to put the directory
sftpDirectory
The SFTP directory to download

Return Value

A list of files transferred
Example
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SFTP server( its URL )
sftp.HostAddress = "sftp.fsz.bme.hu"; // a hungarian university. change this to your sftp server
sftp.UserName = "anonymus"; // replace with your user name
sftp.Password = "user@mail.com"; // replace with your password
 
sftp.EnableLogging();
sftp.Connect();
 
sftp.CurrentDirectory = "/";
 
await sftp.UploadDirectoryInParallelAsync("C:\\Download", "TestDir");
 
sftp.Disconnect();
Dim sftp As New SFTP() 'Trial Mode
'SFTP sftp = new SFTP("place user name here", "place license key here");
 
' set the name of the SFTP server( its URL )
sftp.HostAddress = "sftp.fsz.bme.hu" ' a hungarian university. change this to your sftp server
sftp.UserName = "anonymus" ' replace with your user name
sftp.Password = "user@mail.com" ' replace with your password
 
sftp.EnableLogging()
sftp.Connect()
 
sftp.CurrentDirectory = "/"
 
await sftp.UploadDirectoryInParallelAsync("C:\Download", "TestDir")
 
sftp.Disconnect()
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