Session.EnumerateRemoteFiles Method

Recursively enumerates remote files.

Syntax

C#
public IEnumerable<RemoteFileInfo> EnumerateRemoteFiles(string path, string mask, EnumerationOptions options)
VB.NET
Public Function EnumerateRemoteFiles(ByVal path As String, ByVal mask As String, ByVal options As EnumerationOptions) As IEnumerable(Of RemoteFileInfo)

Parameters

Name Description
string path Full path to root remote directory to start enumeration in.
string mask Windows wildcard to filter files.1) To select all files, use null.
EnumerationOptions options Enumeration options set.
Possible values are:
EnumerationOptions.None - Enumerate matching files only. Do not recurse.
EnumerationOptions.AllDirectories - Recurse into subdirectories.
EnumerationOptions.MatchDirectories - Enumerate also matching directories. Cannot be combined with EnumerationOptions.EnumerateDirectories.
EnumerationOptions.EnumerateDirectories - Enumerate also all directories. Must be used with EnumerationOptions.AllDirectories. Cannot be combined with EnumerationOptions.MatchDirectories.

Return Value

An enumerable collection of the RemoteFileInfo instances representing matched files (and directories, if EnumerationOptions.MatchDirectories or EnumerationOptions.EnumerateDirectories option is used).

Exceptions

Exception Condition
InvalidOperationException Session is not opened.
ArgumentException Invalid combination of options.
SessionLocalException Error communicating with winscp.com.
See the exception documentation for details.
SessionRemoteException Session has failed.
Enumeration of files has failed.
See the exception documentation for details.
TimeoutException Timeout waiting for winscp.com to respond.

Remarks

References to this directory (.) and parent directory (..) are never enumerated.

Use RemoteFileInfo.FullName to retrieve a full path to the enumerated file or directory.

Errors, when listing subfolders, are silently ignored. You can use the Session.Failed event to capture these errors.

The method cannot be used via COM interface (i.e. from VBScript, JScript or VBA).

Examples

Real-Life Examples

1) The Windows wildcard supports * and ? only.
 
  library_session_enumerateremotefiles.txt · Last modified: by martin
 

Search Documentation

This page

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

Associations

Site design by Black Gate