Skip to main content

file

Description

File on the system

Init

file(path string)

Fields

IDTYPEDESCRIPTION
pathstringLocation of the file on the system
basenamestringFilename without path prefix of this file
dirnamestringPath to the folder containing this file
contentstringContents of this file
existsboolIndicator if this file exists on the system
permissionsfile.permissionsPermissions for this file
sizeintSize of this file on disk
useruserOwnership information about the user
groupgroupOwnership information about the group
emptyboolWhether the path is empty

Examples

Test if a directory exists

file('/etc') {
exists
permissions.isDirectory
}