PowerTCP FTP for .NET
Put(List<FileSystemInfo>,String,String,Synchronize) Method
Example 



A list of FileSystemInfo objects representing files to upload and folders to create. Use null to copy all files, directories and subdirectories found in localRoot.
Absolute or relative local root directory from which the files and folders will be copied.
Absolute or relative remote root directory to which the files and folders will be copied.
The file synchronization technique desired, if any.
Put the specified files and folders onto the server using a single method.
Syntax
Public Overloads Function Put( _
   ByVal localFileSystemInfos As List(Of FileSystemInfo), _
   ByVal localRoot As String, _
   ByVal remoteRoot As String, _
   ByVal sync As Synchronize _
) As List(Of CopyResult)
Dim instance As Ftp
Dim localFileSystemInfos As List(Of FileSystemInfo)
Dim localRoot As String
Dim remoteRoot As String
Dim sync As Synchronize
Dim value As List(Of CopyResult)
 
value = instance.Put(localFileSystemInfos, localRoot, remoteRoot, sync)

Parameters

localFileSystemInfos
A list of FileSystemInfo objects representing files to upload and folders to create. Use null to copy all files, directories and subdirectories found in localRoot.
localRoot
Absolute or relative local root directory from which the files and folders will be copied.
remoteRoot
Absolute or relative remote root directory to which the files and folders will be copied.
sync
The file synchronization technique desired, if any.

Return Value

A List of CopyResult objects.
Remarks

localFileSystemInfos must contain DirectoryInfo objects for any subfolders under localRoot containing files specified by FileInfo objects in this list, if the subfolder does not exist in remoteRoot.

DataIsBusy returns true while this method executes.

The local file and directory paths relative to localRoot are assumed to be legal on the remote filesystem. If not, use the other Put methods to specify a legal remote path manually.

Example
This example demonstrates using the FTP control to retrieve multiple files using the FTP GET Command.
public void putMultipleFiles()
{
    //Get a list of files to put.
    System.IO.DirectoryInfo rootDir = new System.IO.DirectoryInfo(myLocalDirectory);
    List<System.IO.FileSystemInfo> files = new List<System.IO.FileSystemInfo>(rootDir.GetFileSystemInfos());

    //Modify the list prior to the Put.
    files.Remove(new System.IO.FileInfo(myLocalDirectory + "\\not_me.txt"));

    //Put the files.
    ftp1.Put(files, myLocalDirectory, "MyTextFiles", Synchronize.Off);
}
Public Sub putMultipleFiles()
    'Get a list of files to put.
    Dim rootDir As New System.IO.DirectoryInfo(myLocalDirectory)
    Dim files As New List(Of System.IO.FileSystemInfo)(rootDir.GetFileSystemInfos())

    'Modify the list prior to the Put.
    files.Remove(New System.IO.FileInfo(myLocalDirectory & "\not_me.txt"))

    'Put the files.
    ftp1.Put(files, myLocalDirectory, "MyTextFiles", 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