Summary
Determines whether the given path refers to an existing file.
- Namespace
- Cake
.Common .IO - Containing Type
- FileAliases
Syntax
[CakeMethodAlias]
[CakeAliasCategory("Exists")]
public static bool FileExists(this ICakeContext context, FilePath filePath)
Examples
if (FileExists("findme.txt"))
{
Information("File exists!");
}
Attributes
Type | Description |
---|---|
Cake |
An attribute used to mark script method aliases. |
Cake |
An attribute used for documentation of alias methods/properties. |
Parameters
Name | Type | Description |
---|---|---|
context | ICakeContext | The context. |
filePath | FilePath | The FilePath to check. |
Return Value
Type | Description |
---|---|
bool | true if filePath refers to an existing file;
false if the file does not exist or an error occurs when trying to
determine if the specified file exists. |