SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

11.6 Checking if a file exists

If you are working with files it is also good to be able to check if a file exists, else you'd have to create an empty file every time you install your script since TCL will return an error if you try to open a file that doesn't exist. This can be done with the file exists command.
The syntax of a file exists command is file exists <filename>.

The <filename> is the name of the file you want to check.
Note that the path from which all external commands or file requests are filed is the directory in which your eggdrop binary resides, so if you want a file from somewhere outside the Eggdrop directory you will have to include the whole path to the file in <filename>.

The file exists command returns 1 if the file exists and a 0 if it doesn't.

[ Previous ] [ Index ] [ Next ]

Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon