logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

stat-file - (files)

Description

stat-file obtains information about <file>, which is a string that is an absolute or relative path. Clause "size" will store file's size in bytes to number <size>, or it will be GG_ERR_FAILED (if operation failed, likely because file does not exist or you have no permissions to access it). Clause "type" will store file's type to number <type>, and it can be either GG_FILE (if it's a file) or GG_DIR (if it's a directory) or GG_ERR_FAILED (if operation failed, likely because file does not exist or you have no permissions to access it). Clause "path" (in string <path>) obtains the fully resolved path of the <file> (including symbolic links), and "name" will provide its <name> (meaning a basename, without the path). If path cannot be resolved, then <path> is an empty string. Clause "mode" will store file's permission mode to number <mode>, see permissions.

Examples

To get file size in variable "sz", which is created here: stat-file "/home/user/file" size sz To determine if the object is a file or a directory: stat-file "/home/user/some_name" type what if-true what equal GG_FILE @It's a file! else-if what equal GG_DIR @It's a directory! else-if @Doesn't exist! end-if Get the fully resolved path of a file to string variable "fp" and the name of the file: stat-file "../file" path fp name fn

Name

stat-file - (files)

Purpose

Get information about a file.

See Also

Files change-modeclose-filecopy-filedelete-filefile-positionfile-storagefile-uploadinglock-fileopen-fileread-fileread-linerename-filestat-filetemporary-fileuniq-fileunlock-filewrite-file See all documentation $DATE $VERSION GOLF(2gg)

Syntax

stat-file <file> \ [ size <size> ] [ type <type> ] \ [ path <path> ] [ name <name> ] \ [ mode <mode> ]

See Also