How to find a latest file from any folder
Answer Posted / manjunathareddy
sPath="C:\FlightFrameWork"
Msgbox GetNewestFile(sPath)
Function GetNewestFile(ByVal sPath)
sNewestFile = Null
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPath)
Set oFiles = oFolder.Files
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
End If
On Error Goto 0
Next
If IsNull(sNewestFile) Then sNewestFile = ""
GetNewestFile = sNewestFile
End Function
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans
Explain few date functions in vbscript?
How to delete a cookie using vbscript?
Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder
Which function allows you to instantiate an object given its programmatic identifier or progid?
How will you get a combined string from array of string in vbscript?
What methods are used to create text files and open text files in the vbscript language?
Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...
Mention what if you do not specify anything when you call a procedure?
what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?
Explain what is loose binding? Why is it not a good practice to use it?
Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.
Which operator is used to concatenate the 2 values in the vbscript language?
What is the difference between javascript and vbscript?
What are the different types of loops available in the vbscript language?