home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
tcl_447.lzh
/
TCL
/
tcl.lzh
/
tcl
/
help
/
file
< prev
next >
Wrap
Text File
|
1990-05-03
|
2KB
|
62 lines
file name option
Operate on a file or a file name. Name is the name of
a file, and option indicates what to do with the file
name. Any unique abbreviation for option is
acceptable. The valid options are:
file name dirname
Return all of the characters in name up to but not
including the last slash character. If there are
no slashes in name then return ``.''. If the last
slash in name is its first character, then return
``/''.
file name executable
Return 1 if file name is executable by the current
user, 0 otherwise.
file name exists
Return 1 if file name exists and the current user
has search privileges for the directories leading
to it, 0 otherwise.
file name extension
Return all of the characters in name after and
including the last dot in name. If there is no
dot in name then return the empty string.
file name isdirectory
Return 1 if file name is a directory, 0 otherwise.
file name isfile
Return 1 if file name is a regular file, 0
otherwise.
file name owned
Return 1 if file name is owned by the current
user, 0 otherwise.
file name readable
Return 1 if file name is readable by the current
user, 0 otherwise.
file name rootname
Return all of the characters in name up to but not
including the last ``.'' character in the name.
If name doesn't contain a dot, then return name.
file name tail
Return all of the characters in name after the
last slash. If name contains no slashes then
return name.
file name writable
Return 1 if file name is writable by the current
user, 0 otherwise.
The file commands that return 0/1 results are often
used in conditional or looping commands, for example:
if {![file foo exists]} then {error {bad file name}} else {...}