Question : wildcard usage in Scripting.FileSystemObject<wbr /> for dts workflow

i need to find out if a set of files exist in a directory before i execute a step in a dts package

i am in the active x scrip properties of the work flow of the step itself
the one that sends back a DTSStepScriptResult_executeTask if it is ok to dp tje ste[

ALL I need is to determine if  one or more files of the form specca*.txt exist.

i dont even need to loop through them,   jest find out fi the exist

i have tried
dim ss
ss = dir("F:\mgr\log\speecca*.txt")
if len(ss) >0 then
oktorun
else
notoktorun
end if

which parses fine but get a type mis match trying to execute the dir command
not the assignment   but the dir command
i get the type mismatch if i just do a msgbox(dir("F:\mgr\log\speecca*.txt")

i have tried filesystemobject    
but cannot seem to find any file related methods that accept wild cards.

i think the DIR is the simplest one,   if i could get by the type mismatch

i get a type

Answer : wildcard usage in Scripting.FileSystemObject<wbr /> for dts workflow

Loop through the files:



Dim fso, fld, fil, FoundIt

Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("F:\mgr\log")
FoundIt = False
For Each fil In fld.Files
    If LCase(Left(fil.Name, 7)) = "speecca" and LCase(Right(fil.Name, 4)) = ".txt" Then
        FoundIt = True
        Exit For
    End If
Next

If FoundIt Then oktorun Else notoktorun

Set fil = Nothing
Set fld = Nothing
Set fso = Nothing
Random Solutions  
 
programming4us programming4us