Custom Search

Friday, August 10, 2012

Getting Newest file from folder

spath ="C:\eLink\Log"
str=GetNewestFile(spath)
Function GetNewestFile(spath)
sNewestFile = Null ' init value
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPath)
Set oFiles = oFolder.Files
' enumerate the files in the folder, finding the newest file
For Each oFile In oFiles
On Error Resume Next
If IsNull(sNewestFile) Then
sNewestFile = oFile.Path
dPrevDate = oFile.DateLastModified
Elseif dPrevDate < oFile.DateLastModified Then
sNewestFile = oFile.Path
dPrevDate = oFile.DateLastModified
End If
On Error Goto 0
Next
If IsNull(sNewestFile) Then sNewestFile = ""
GetNewestFile=sNewestFile
End Function

Between QTP 9.5 & earlier versions

1. Checkpoints and Output values can be seen & edited in the OR while same was not possible in the earlier versions of QTP.
2. Installation file is a single one bundled with all add-ins, previously we have to download add-ins separately.
3. Movie recorder was introduced in the results
4. Web add-in extensibility add- in was introduced
5. Maintenance run mode was introduced
6. It also supports the 64 bit windows edition while the earlier were supporting only 32 bit systems only
7. Bitmap tolerance feature was introduced in QTP 9.5