Function
CheckIfFileExists(ByVal FolderPath, ByVal FileName) As Boolean
Dim objFSO
Dim objFolder, file
objFSO = CreateObject("Scripting.FileSystemObject")
objFolder = objFSO.GetFolder(FolderPath)
For Each file In objFolder.files
If LCase(file.name) = Trim(LCase(FileName)) Then
FileExists =
True
Else
FileExists =
False
End If
Next
objFSO =
Nothing
Return FileExists
End Function
Private
Sub ShowFiles(path as string)
Dim d() As String
d = System.IO.Directory.GetFiles(path)
Dim en As System.Collections.IEnumerator
en = d.GetEnumerator
While en.MoveNext
MsgBox(CStr(en.Current))
End While
End Sub
Function
CheckFolderExists(ByVal sFolderName)
EventLog1.WriteEntry("inside checkfolder func - begin")
Dim FileSystemObject
FileSystemObject = CreateObject("Scripting.FileSystemObject")
If (FileSystemObject.FolderExists(sFolderName)) Then
CheckFolderExists =
True
Else
CheckFolderExists =
False
End If
FileSystemObject =
Nothing
EventLog1.WriteEntry("file exists - " & CheckFolderExists)
EventLog1.WriteEntry("inside checkfolder func - end")
End Function
Function
CreateNewFolder(ByVal Path, ByVal NewFolderName)
Dim objFSO
objFSO = CreateObject("Scripting.FileSystemObject")
Dim FullPath
FullPath = Path & NewFolderName
If Not objFSO.FolderExists(FullPath) Then
objFSO.CreateFolder(FullPath)
CreateNewFolder =
True
Else
CreateNewFolder =
False
End If
objFSO =
Nothing
End Function