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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorry if this is the wrong list, bu 1

Status
Not open for further replies.

ls62

Programmer
Oct 15, 2001
177
US
Sorry if this is the wrong list, but maybe someone can help.
I'm really new to tcl and I'm writing a expect script and need to test if a file exists and if it does remove it. I can't seem to find/figure out syntax for the 'if' or testing of a file. Can someone give the the syntax?

Here's what I'm looking for:

if file exists AFILE ; then
exec rm AFILE
ENDIF

Thanks for any help.

LEE
 
Code:
if {[file exists [file join $path]]} {
    file delete [file join $path]
}

Expect is an extension of tcl and all tcl commands
are available.
Please check out and check
there first for any problems you may have.
 
marsd,

Thank you! [thumbsup] Thats exactly what I needed and it worked great. I already checked out the web page you mentioned and will be using it for further reference. Just what I was looking for.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top