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  


What are class events?

0 Answers  


regular expression that will recognize a browser as long as its name property starts with mybrowser

0 Answers   Banking,


Explain the operator precedence in vb script?

0 Answers  


Find Out Length of an array without using Ubound?

1 Answers  






When to use function procedures and what are its characteristics?

0 Answers  


how to operate webobjects in a webpage using getobject function and then using generic methods?

0 Answers  


There is a web Table where You will find Two Columns First Column consist of Check box and Second column consist of Test cases ID(Viz T1,T2,T3....Etc); If You select any Test case ID, respective Check boxes to be checked write a VBSCRIPT for this scenario?

1 Answers   eMids,


Which function is used in the vbscript language to convert the specified expression into a date type value?

0 Answers  


How to assign a numeric value to a variable?

0 Answers  


Hi, I need to accept user inputs for login at runtime.I know i can use Inputbox but how to proceed further that i dont know. Thanks in advance

2 Answers  


how to declare a variable in vbscript using vbscript

4 Answers  


Categories