How to find a latest file from any folder

Answers were Sorted based on User's Feedback



How to find a latest file from any folder..

Answer / david

in solaris / unix you can find the latest file by...


ls -lt

Is This Answer Correct ?    4 Yes 0 No

How to find a latest file from any folder..

Answer / 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

How to find a latest file from any folder..

Answer / sha

How to find a latest file from any folder by using vb script?

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More VB Script Interview Questions

What is the use of the instr function?

0 Answers  


write a vb script to find simple interest using functions

1 Answers  


Mention how to create a cookie using vbscript?

0 Answers  


1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)

0 Answers   iFlex,


How will you release the memory acquired by an array variable in vbscript?

0 Answers  






hi Set myobj=Description.Create() myobj("type").value="submit" myobj("name").value="google search" myobj("html tag").value="button" browser("title:=google").page("title:=google").webButton (myobj).Click i was running above code in one weak back it was working fine i got result,again i opened after few days ,again i was trying to run the code it shows run time error in last line of my code ,why ?pls answer my question?

0 Answers  


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.

0 Answers  


Can automation testing find ssame no. of bugs what we can find by manual testing?

0 Answers  


Which object is used to work with the database in the vbscript language and what statement is used to create this object?

0 Answers  


Why to use option explicit in vb script?

0 Answers  


How to write a general script which should does the following a). If a page object is given, it should identify the page object of the corresponding page(site). b). It should identify all the links of that particular page. in QTP tool?

2 Answers   IBM, Infosys, Wipro,


What are the valid scopes of a variable in vbscript?

0 Answers  


Categories