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"
|