Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check for presence of a file .... 1

Status
Not open for further replies.

RVSachin

Technical User
Nov 12, 2001
77
IN
Hi,

Someone please help me to find out the command/code which can check if a particular file has been created.

I run a TCL script which will create a file fil.txt during the execution. In the same script I need to check for the presence of fil.txt and if it does exist, then exit the script or keep checking for the file until it is found.

Thanks,

RV
 
easy:
Code:
file exists fil.txt
# you might want to use file join as well to
# get the proper path
file exists [file join [pwd] "fil.txt]
 
From the manual:

file exists name
Returns 1 if file name exists and the current user has search privileges for the directories leading to it, 0 otherwise.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top