GOLF(2gg)
π GOLF(2gg) β stat-file, bestie
okay so real quick: this is the GOLF manual, section 2gg (the Development girlies π). Yes, the header says GOLF(2gg) and yes we're still on that. Sit down, hydrate, let's talk about stat-file.
β¨ NAME β¨
stat-file β (files) ποΈ
π― PURPOSE π―
Get information about a file. That's it. That's the whole job. Lowkey iconic for how much it does though. π
π©· SYNTAX π©·
stat-file <file> \
[ size <size> ] [ type <type> ] \
[ path <path> ] [ name <name> ] \
[ mode <mode> ]
like... you give it a <file>, you pick which clauses you want, she handles the rest. no notes. πΈ
π DESCRIPTION π
stat-file obtains information about <file>, which is a string that is an absolute or relative path. fr fr, just a path string, that's all she needs.
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). so if the number comes back cursed, that's why π
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). three possible vibes. pick your fighter. π
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. not me getting an empty string and panicking π
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
the branching?? the drama?? she ate that. π₯
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
two clauses, one call, main character energy honestly. π¦
π SEE ALSO π
Files π
change-mode close-file copy-file delete-file file-position file-storage file-uploading lock-file open-file read-file read-line rename-file stat-file temporary-file uniq-file unlock-file write-file β and See all documentation for the full group chat π
bestie reminder: if a clause can't do its thing (file missing, no permissions), you're getting GG_ERR_FAILED or an empty string, not an error message with feelings. check your returns, periodt. π
okay that's the whole page, mwah π«Ά this was version $VERSION, dated $DATE, and yeah it's filed under GOLF(2gg) forever and ever β¨ no cap, go stat something π
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms