GlobbingAliases.

GetFiles(ICakeContext, string, Func<IDirectory, bool>) Method

Summary

Gets all files matching the specified pattern.
Namespace
Cake.Common.IO
Containing Type
GlobbingAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Files")]
[Obsolete("Please use the GetFiles overload that accept globber settings instead.", false)]
public static FilePathCollection GetFiles(this ICakeContext context, string pattern, Func<IDirectory, bool> predicate)

Examples

 Func<IFileSystemInfo, bool> exclude_node_modules =
     fileSystemInfo => !fileSystemInfo.Path.FullPath.EndsWith(
         "node_modules", StringComparison.OrdinalIgnoreCase);

 var files = GetFiles("./**/Cake.*.dll", exclude_node_modules);
 foreach(var file in files)
 {
     Information("File: {0}", file);
 }

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
CakeAliasCategoryAttribute An attribute used for documentation of alias methods/properties.
ObsoleteAttribute

Parameters

Name Type Description
context ICakeContext The context.
pattern string The glob pattern to match.
predicate Func<IDirectory, bool> The predicate used to filter directories based on file system information.

Return Value