I'm new to DTS. I'm trying to find the first file that matches a pattern, but this keeps returning the pattern, nmot the file name that matches it. So the source file is "polh*.dat" rather that "polh_06262006.dat"
Then, of course, the step to transfer the text file fails.
Function Main()
Dim oFSO
Dim sSourceFile
Dim sDestinationFile
Dim iFileName
Dim iDirectory
Dim iPattern
Dim iNewDirectory
Dim conTextFile
Dim Pkg
set pkg = DTSGlobalVariables.Parent
Set oFSO = CreateObject("Scripting.FileSystemObject")
iDirectory = "c:\test\"
iPattern = "polh*.dat"
iNewDirectory = iDirectory & "History\test\"
iFileName = (iDirectory & iPattern)
DTSGlobalVariables("hFile").Value = iFileName
set conTextFile = pkg.Connections("polh")
conTextFile.DataSource = DTSGlobalVariables("iFileName").Value
oFSO.CopyFile sSourceFile, sDestinationFile
' Clean Up
Set oFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
Then, of course, the step to transfer the text file fails.
Function Main()
Dim oFSO
Dim sSourceFile
Dim sDestinationFile
Dim iFileName
Dim iDirectory
Dim iPattern
Dim iNewDirectory
Dim conTextFile
Dim Pkg
set pkg = DTSGlobalVariables.Parent
Set oFSO = CreateObject("Scripting.FileSystemObject")
iDirectory = "c:\test\"
iPattern = "polh*.dat"
iNewDirectory = iDirectory & "History\test\"
iFileName = (iDirectory & iPattern)
DTSGlobalVariables("hFile").Value = iFileName
set conTextFile = pkg.Connections("polh")
conTextFile.DataSource = DTSGlobalVariables("iFileName").Value
oFSO.CopyFile sSourceFile, sDestinationFile
' Clean Up
Set oFSO = Nothing
Main = DTSTaskExecResult_Success
End Function