Here's the code I am currently using.
'grab path from class
Dim strImportPath As String = objclsData.strImportPath
Dim strCSVWildcard As String =
ConfigurationSettings.AppSettings("CSVWildcard")
Dim strAppWorkingDir As String =
ConfigurationSettings.AppSettings("AppWorkingFolde r")
Dim objfile As FileInfo
Dim objDirSource As New DirectoryInfo(strImportPath)
Try
If Not Len(strImportPath) > 0 Then
objclsUtils.WriteStatusbarMessage("You have not selected
the path of the CSV files!")
Exit Try
End If
'if it doesn't exist create working folder
If Not Directory.Exists(strAppWorkingDir) Then
Directory.CreateDirectory(strAppWorkingDir)
End If
'copy files to working directory
For Each objfile In objDirSource.GetFiles(strCSVWildcard)
objfile.CopyTo(Path.Combine(strAppWorkingDir,
objfile.Name), True)
Next
'copy local version of batch file to working directory
Dim objBATFile As New
FileInfo(ConfigurationSettings.AppSettings("BatchF ile"))
FileCopy(objBATFile.ToString, strAppWorkingDir)
objBATFile = Nothing
Catch ex As Exception
strEvt = ex.Source.ToString & ": " & vbCrLf & "Message: " &
ex.Message & vbCrLf & vbCrLf & ex.InnerException.ToString
objclsUtils.writeEventLogError(strEvt)
The filecopy command keeps returning "target directory exist".
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!