PowerTCP FTP for .NET
Get(String,String,Synchronize) Method
Example 



An absolute or relative path to the source file on the server.
Path to the local file to create.
The file synchronization technique desired, if any.
Downloads a file from an FTP server.
Syntax
Public Overloads Function Get( _
   ByVal remotePath As String, _
   ByVal localPath As String, _
   ByVal sync As Synchronize _
) As CopyResult
Dim instance As Ftp
Dim remotePath As String
Dim localPath As String
Dim sync As Synchronize
Dim value As CopyResult
 
value = instance.Get(remotePath, localPath, sync)
public CopyResult Get( 
   string remotePath,
   string localPath,
   Synchronize sync
)
public:
CopyResult^ Get( 
   String^ remotePath,
   String^ localPath,
   Synchronize sync
) 

Parameters

remotePath
An absolute or relative path to the source file on the server.
localPath
Path to the local file to create.
sync
The file synchronization technique desired, if any.

Return Value

CopyResult containing the result of the operation.
Remarks
DataIsBusy returns true while this method executes. Paths may be specified as relative or absolute.
Example
This example demonstrates using the FTP control to retrieve a file using the FTP GET command.
private void button1_Click(object sender, EventArgs e)
{
    //Connect to the FTP Server.
    ftp1.Connect(myServer);

    //Login with user credentials
    ftp1.Authenticate(myUsername, myPassword);

    //Retrieve a file.
    ftp1.Get("testfile.txt", Path.Combine(myLocalDirectory, "testfile.txt"), Synchronize.Off);

    //Close the connection.
    ftp1.Close();
}
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    'Connect to the FTP Server.
    ftp1.Connect(myServer)

    'Login with user credentials
    ftp1.Authenticate(myUsername, myPassword)

    'Retrieve a file.
    ftp1.Get("testfile.txt", Path.Combine(myLocalDirectory, "testfile.txt"), Synchronize.Off)

    'Close the connection.
    ftp1.Close()
End Sub
See Also

Reference

Ftp Class
Ftp Members
Overload List


PowerTCP FTP for .NET Documentation Version 6.1
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic