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
How to write a VBscript for web page performance test i need a code send if any knows the code If any knows VBScript book plz send to me the link to my mail plz
How to assign a date value to a variable?
When to use function procedures and what are its characteristics?
What is vbscript?
How will you get a string with the specified character the specified number of times in vbscript?
How will you convert a string to lower case string using vbscript?
Mention what is byref and byval parameters in vbscript?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.
What are events in the vbscript language?
write a program to display configuration of a local system with the help of vb script.
Set srchobj=Description.Create() srchobj("type").value="text" srchobj("name").value="q" srchobj("html tag").value="input" browser("micclass:=google").Page("micclass:=google").webedit (srchobj).Set "qtp" what's wrong in my code pls tell me ? the above code working fine and i got my result pass,now i am trying to run the program it shows general run time error why?pls help me i am in learning stage ?
wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......
Which constant is used for print and display functions and works as same as pressing enter key?
Why is the use of exit do or exit for statements within loops discouraged?
What are the environments supported by vbscript language?