stat

The operating system call, and matching command, that reports a file's details such as size, mode and modification time without opening it.

In more detail

It answers questions such as does this path exist and how big is it. A missing file and an unreadable file produce different errors, which careful tools handle differently.

Examples

info, err := os.Stat("probe.conf")
Go: info, err := os.Stat(path); errors.Is(err, os.ErrNotExist)

Related terms

Taught in

References