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
Explain about .wsf files?
What are class variables?
How will you get a combined string from array of string in vbscript?
When does ‘on click of button’ event gets triggered in the vbscript language?
what is the use of QCUtil? explain with one example?
Hi Friends Rajendra this is bhavani prasad, iam working Hyderabad. i faced one problem with qtp recording mode i.e in my application there is 100 records first we click the first record that record will be jumped to next session and 99 records will there stop the recording and run the same script .Run this script qtp does not identify the records. So plz tell me what is the solution.
Anyone have qtp11.0 crack?
what is the standards used for writing the script in QTP
How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.
What is the event handling in vbscript?
How will you check that a variable is an array in vbscript?
How do i automate a website www.flyashx.com without having any test cases witin a week time.
Write a function for Instr(). We need to write a function that works as same as Instr(). Code or Even pseudo code is good enough for me.?
How will you get a subset of a array in vbscript?
How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...