QTP code to check if a txt file is available or not, if not creating the File

March 24, 2010

Below is the code for QTP to check if a txt file is available or not, if not creating the File
strDirectory="D:\"

strFile="Scripting.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strDirectory & strFile) Then
Set objFolder = objFSO.GetFolder(strDirectory)
Else
Set objFile = objFSO.CreateTextFile("D:\Log.txt")
End if

You Might Also Like

0 comments