file stat

Puts the facts of a file in an array.

file stat NAME VAR

Description

Sets the elements of the array VAR to the facts of NAME: atime, ctime, dev, gid, ino, mode, mtime, nlink, size, type, and uid. A missing file is an error.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredThe path.
VARarray namerequiredThe array for the facts.

Returns

An empty string.

Examples

% set f [open n.txt w]; puts -nonewline $f hello; close $f
> file stat n.txt st
> list $st(size) $st(type)
5 file

% set f [open q w]; close $f
> file stat q s
> lsort [array names s]
atime ctime dev gid ino mode mtime nlink size type uid

Errors

% file stat nope.txt st
could not read "nope.txt": no such file or directory
-errorcode POSIX ENOENT {no such file or directory}

% file stat nope.txt
wrong # args: should be "file stat name varName"
-errorcode NONE

Facts

Capability
file. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also