Is there are problem using the "Like" operator in VB Script Language in a DTS ActiveX Script ?
I get an error description of sub or function not defined when I run the code below but if I use
[If oFile.Name = "MainReferral99.csv" Then] instead then the code runs ok.
Function Main()
Dim oFSO
Dim sDirectoryPath
Dim oFolder
Dim oFileCollection
Dim oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
sDirectoryPath = "S:\ThamesProcessing\"
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
For Each oFile In oFileCollection
If oFile.Name like "*Referral*.csv" Then
MsgBox oFile.Name
' oFile.Delete (True)
End If
Next
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
Main = DTSTaskExecResult_Success
End Function
I get an error description of sub or function not defined when I run the code below but if I use
[If oFile.Name = "MainReferral99.csv" Then] instead then the code runs ok.
Function Main()
Dim oFSO
Dim sDirectoryPath
Dim oFolder
Dim oFileCollection
Dim oFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
sDirectoryPath = "S:\ThamesProcessing\"
Set oFolder = oFSO.GetFolder(sDirectoryPath)
Set oFileCollection = oFolder.Files
For Each oFile In oFileCollection
If oFile.Name like "*Referral*.csv" Then
MsgBox oFile.Name
' oFile.Delete (True)
End If
Next
Set oFSO = Nothing
Set oFolder = Nothing
Set oFileCollection = Nothing
Set oFile = Nothing
Main = DTSTaskExecResult_Success
End Function