PowerTCP FTP for .NET
Get(List<ListEntry>,String,String,Synchronize) Method
Example 



A List of files to download. Use null to indicate the complete directory tree.
Absolute or relative remote root directory from which the files and folders will be copied.
Absolute or relative local root where files are to be copied to. Existing files will be overwritten.
The file synchronization technique desired, if any.
Get the specified files using a single method.
Syntax
Public Overloads Function Get( _
   ByVal remoteFiles As List(Of ListEntry), _
   ByVal remoteRoot As String, _
   ByVal localRoot As String, _
   ByVal sync As Synchronize _
) As List(Of CopyResult)
Dim instance As Ftp
Dim remoteFiles As List(Of ListEntry)
Dim remoteRoot As String
Dim localRoot As String
Dim sync As Synchronize
Dim value As List(Of CopyResult)
 
value = instance.Get(remoteFiles, remoteRoot, localRoot, sync)

Parameters

remoteFiles
A List of files to download. Use null to indicate the complete directory tree.
remoteRoot
Absolute or relative remote root directory from which the files and folders will be copied.
localRoot
Absolute or relative local root where files are to be copied to. Existing files will be overwritten.
sync
The file synchronization technique desired, if any.

Return Value

A List of CopyResult objects.
Remarks

If the file or directory paths relative to remoteRoot contain characters that are invalid for the local filesystem, those characters will be replaced with an underscore when constructing the local path.

DataIsBusy returns true while this method executes.

Example
This example demonstrates using the FTP control to retrieve multiple files using the FTP GET Command.
public void getMultipleFiles()
{
    //Retrieve a list of txt files to transfer.
    List<ListEntry> filesToGet = ftp1.ListDirectoryTree("MyTextFiles", "*.txt", true);

    //Tailor the list to not include a specific file.
    foreach (ListEntry entry in filesToGet)
    {
        if (entry.Name == "not_me.txt")
        {
            filesToGet.Remove(entry);
            break;
        }
    }

    //Retrieve the files.
    string workingDirectory = ftp1.GetDirectory();
    ftp1.Get(filesToGet, workingDirectory + "/MyTextFiles", myLocalDirectory, Synchronize.Off);
}
Public Sub getMultipleFiles()
    'Retrieve a list of txt files to transfer.
    Dim filesToGet As List(Of ListEntry) = ftp1.ListDirectoryTree("MyTextFiles", "*.txt", True)

    'Tailor the list to not include a specific file.
    For Each entry As ListEntry In filesToGet
        If entry.Name = "not_me.txt" Then
            filesToGet.Remove(entry)
            Exit For
        End If
    Next entry

    'Retrieve the files.
    Dim workingDirectory As String = ftp1.GetDirectory()
    ftp1.Get(filesToGet, workingDirectory & "/MyTextFiles", myLocalDirectory, Synchronize.Off)
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