View Single Post
  #2  
Old 05-15-2003, 04:15 PM
pjaquiery pjaquiery is online now
Registered User
 
Join Date: 01-19-2003
Location: Dunedin, New Zealand
Posts: 114
The following JScript function does the trick:

function FileExists (filename)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
return fso.FileExists(filename);
}


The VBScript version would be similar, but I don't have an example of it.

One way to use the it is to put something like the following in a script step:

if (! FileExists ("filePath\\fileName"))
throw "failure"

Note that the path seperator '\' needs to be quoted in JScript strings. This can be a real trap if you have the file name in a macro and do this:

"%FileName%"

where %FileName% = filePath\fileName

the result is:

"fileNamefilePath"
Reply With Quote