file size

Gives the size of a file in bytes.

file size NAME

Description

Gives the count of bytes of the file NAME. A missing file is an error.

Arguments

ArgumentTypeDefaultDescription
NAMEpathrequiredThe path.

Returns

A non-negative integer.

Examples

% set f [open n.txt w]; puts -nonewline $f hello; close $f
> file size n.txt
5

Errors

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

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