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

Explain about arrays in vb script?

0 Answers  


How to write VB script for login module?

0 Answers  


Hello Guys, If any body looking for "worksoft certify tool training in bangalore", please contact me aimansaud@gmail.com

0 Answers  


write a vb script to find simple interest using functions

1 Answers  


What are the advantages of vbscript?

0 Answers  






how does vb script help in web page designing? explain with example.

0 Answers  


i am having some basic knowledge in c and VB 6.0. i qtp i want to know how to write the codings. by recording it is generating lot of codings. for example i want to test the text box. senerio is text box should not accept alphabets if it accept alphabets we should return fail status if it get number we should return pass status. how to write coding in vb script please help me

0 Answers  


How will you get a random number between 0 and 1 in vbscript?

0 Answers  


How many data types are supported in Vbscript?

3 Answers   Microsoft,


Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.

0 Answers  


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

0 Answers   IBM,


what is fire event method in qtp?

3 Answers   TCS,


Categories