file atime filename
set access_time [file atime "index.adp"] ==> 916612934
file dirname filename
set parent_dir [file dirname "~/home/dir/this.adp"] ==> ~/home/dir
file executable filename
chmod 1111 billg-wealth.tcl
file executable billg-wealth.tcl ==> 1
file exists filename
file exists billg-wealth.tc ==> 0
file exists billg-wealth.tcl ==> 1
file extension filename
file extension billg-wealth.tcl ==> .tcl
file isdirectory filename
file isdirectory . ==> 1
file isdirectory billg-wealth.tcl ==> 0
file isfile filename
file isfile billg-wealth.tcl ==> 1
file lstat filename variablename
stat
command on linkname into
variablename.
ln -s billg-wealth.tcl temp.tcl
file lstat temp.tcl temp ==> (array holding stat info)
file mtime filename
file modify billg-wealth.tcl ==> 915744902
file owned filename
file owned billg-wealth.tcl ==> 1
file readable filename
file readable billg-wealth.tcl ==> 1
file readlink filename
ln -s file.txt file1.txt
file readlink file1.txt ==> file.txt
file rootname filename
file rootname billg-wealth.tcl ==> billg-wealth
file size filename
file size billg-wealth.tcl ==> 774
file stat filename variablename
file stat billg-wealth.tcl billg_info
set $billg_info(ctime) ==> 916615489
file tail filename
file tail ~/home/dir/subdir/file.txt ==> file.txt
file type filename
file type billg-wealth.tcl ==> file
file writable filename
file writable billg-wealth.tcl ==> 0
open filename ?access? ?permissions?
set this_file_stream [open /tmp/file.txt r]
More: http://www.tcl.tk/man/tcl8.4/TclCmd/open.htm
puts ?-nonewline? ?stream? string
puts "Hello, world." ==> Hello, world.
More: http://www.tcl.tk/man/tcl8.4/TclCmd/puts.htm
gets stream ?varname?
gets $thisstream line
More: http://www.tcl.tk/man/tcl8.4/TclCmd/gets.htm
read streamname ?numbytes?
set first_ten_bytes [read $this_stream 10]
More: http://www.tcl.tk/man/tcl8.4/TclCmd/read.htm
read -nonewline streamname
set this_file_contents [read -nonewline $this_stream]
tell streamname
set seek_offset [tell $this_stream]
More: http://www.tcl.tk/man/tcl8.4/TclCmd/tell.htm
seek streamname offset ?origin?
start, current, or
end
.
seek $this_stream offset end
More: http://www.tcl.tk/man/tcl8.4/TclCmd/seek.htm
eof stream
if {[eof $this_stream]} {
break
}
More: http://www.tcl.tk/man/tcl8.4/TclCmd/eof.htm
flush streamname
flush $this_stream
More: http://www.tcl.tk/man/tcl8.4/TclCmd/flush.htm
close streamname
close $this_stream
More: http://www.tcl.tk/man/tcl8.4/TclCmd/close.htm
eval
.