Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))

Directory.GetFileSystemEntries Method

Class

System.IO.Directory

Syntax

Dim result( ) As String = Directory.GetFileSystemEntries(path[, _ searchPattern])

path (required; String)

A valid path to a directory

searchpattern (optional; String)

A file specification, optionally including the wildcard characters * and ?.

Description

The GetFileSystemEntries method returns a string array with the names of all files and directories in the specified directory, optionally matching a pattern.

Usage at a Glance

  • path can be either an absolute path or a relative path from the current directory.

  • path can be either a path on the local system, the path of a mapped network drive, or a UNC path.

  • path cannot contain wildcard characters, but searchPattern can.

  • If the directory specified by path has no files or subdirectories, or if no files or subdirectories match searchPattern, an empty array is returned.

  • This method combines the functionality of the GetDirectories and GetFiles methods.

Version Differences

Visual Basic 2005 includes a My.Computer.FileSystem object that provides access to detailed information about files and directories.

See Also

Directory.GetDirectories Method, Directory.GetFiles Method

Категории