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!

Wildcard not accepted..?

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
SE
Hi all,

How can I get a script in a DTS-package to accept a wildcard (*)?
sFilename="OTBRFC-E001*.txt"

/Kent J.
 
yksvaan,
I'm setting a textfile as a datasource.
First I have to check if it exists.
The end of the name can change so that's why I have to use a wildcard. Example: OTBRFC-E001_TST00005.txt should be substitude as OTBRFC-E001_TST*.txt


Function Main()
Dim oConn, sFilename, lobjFSO

' Filename format - exyymmdd

sFilename = "d:\Infile\" & Right(Year(Now()), 2)
If Month(Now()) < 10 Then sFilename = sFilename & "0" & _
Month(Now()) Else sFilename = sFilename & Month(Now())
If Day(Now()) < 10 Then sFilename = sFilename & _
"0" & Day(Now()) Else sFilename = sFilename & Day(Now())
sFilename=sFilename & "OTBRFC-E001_TST00005.txt"
sFilename = DTSGlobalVariables("LogFilePath").Value & _
sFilename


Set oConn = DTSGlobalVariables.Parent.Connections("Text File (Source)")
oConn.DataSource = sFilename

Set oConn = Nothing

Set lobjFSO = CreateObject("Scripting.FileSystemObject")

If Not lobjFSO.FileExists(sFilename) Then
Main = DTSStepScriptResult_DontExecuteTask
else
Main = DTSTaskExecResult_Success
end if
End Function
 
I not a vbscript guy, but I think you have to loop through the folder object's Files property, so no wildcards.

There's a VBscript forum and FAQs, you could try there.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top