directory class : GetFiles(string) method

Description

Gets a list of files that match to the specified pattern.

Syntax

directoryInstance.GetFiles(string pattern)

Arguments

ClassNameDescription
stringpatternSearch pattern.

Return value

ClassDescription
list{file}A list of files that match to the specified pattern.

Sample code

1:

directory dir = new directory("c:\somewhere...");

2:

list{file} txtFiles = dir.GetFiles("*.txt"); // Files with the ".txt" extension.

Notes

It's a wrapper of the System.IO.DirectoryInfo.GetFiles(String) method.

Please note that this method do not work recursively. It returns a list of direct children.

Links for reference

Copyright © Cooker All rights reserved.