FileAliases.

FileSize(ICakeContext, FilePath) Method

Summary

Gets the size of a file in bytes.
Namespace
Cake.Common.IO
Containing Type
FileAliases

Syntax

[CakeMethodAlias]
[CakeAliasCategory("Exists")]
public static long FileSize(this ICakeContext context, FilePath filePath)

Examples

Information("File size: {0}", FileSize("./build.cake"));

Attributes

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

Parameters

Name Type Description
context ICakeContext The context.
filePath FilePath The path.

Return Value

Type Description
long Size of file in bytes or -1 if file doesn't exist.