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

How you can call vbscript functions?

0 Answers  


Explain the .wsf files?

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  


PLz send me the VB scripts which is having more examples my email id : hareen_11@yahoo.com

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,






if there is any string in a given format like as "company name employeecode date" then we have to fetch employeecode form string for ex-string is "capgemini12345june2013" then we have to fetch 12345 by using vb script so guys how can we do that please reply it.

3 Answers   Cap Gemini,


How to take whole text output from screen of Bitmap Application.

0 Answers   CitiGroup,


Hi I don't have any idea on VBscript. can any one point me to a good web site to learn VBscript. Regards lina

2 Answers  


In our application qtp unable to indentify the menu items,we tried number of times to add objetcs into object repository but fail. through normal recording mode only objects going to add into repository but while running same recording script qtp showing a error like " unable to indentify the object". in repository there is no any properties and pro values for that object and also i tried with virtual object config also unable to find the object in application and in repository. Then what i have to do to identify menu objects????? can anybody hell me pls..............

2 Answers   Blue Star,


Mention when to use function procedures and what are its characteristics?

0 Answers  


Hi everybady, i have faced few Qns in one of i attended interview, please help me out with these below Qns. 1. how to join values without using join function? 2. how to compare values without using String compare function? 3. input is Bangalore, but i need output like this below format, what is function to use and get this outcome B A N G A L o R E 4. Input is "CapGemini" but uotput should be like this "inimeGpaC" 5. Input is 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Can someone let me know results of this Qns, please. Thanks.

2 Answers   CSS Corp,


Mention what is the difference between vbscript and vba?

0 Answers  


Categories