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

Write a Program to add 2 numbers without using operators (+,-) and without using third variable. Note: Use VBScript only Hint: You can use other operators like '/' & '*'(Division & Multiplication)

0 Answers   Quest,


What are the special sub-types in vbscript?

0 Answers  


Explain the arrays in vb script?

0 Answers  


create a form to accept username and password validate the username and password with using message box, display the corresponding user message

0 Answers   CSC,


Which in-built functions are used to convert the specified expression in the form of date and string in the vbscript language?

0 Answers  






Anyone have qtp11.0 crack?

0 Answers  


I want good books or good sites for scripting.Can any one help me.

0 Answers   Wipro,


reverse the string without using reverse string?

2 Answers   CSS Corp,


How do you write an SQL insert statement?

4 Answers   HCL,


Like OPTION EXPLICIT statement what are the other statements used in vbscript and their usage. Please post me all the statements please.

0 Answers   Accenture,


I'm new to QTP, i facing a a problem in the script says"Object not found", "Browser("").page("").frame(Name:=fminfo).webtable(). the issue is, QTp is not able to identify the web table in run time.becuase in that fram"fminfo" there are "n"table and the table do not have the names,Html id. 1) i need to count the number webtables available on that page. 2)need to identify the webtable cell values. 3)How Loop the once i get the count and retrive the cell data of each webtable? Can anyone help on this, plz.. Thanks, Suresh

3 Answers  


What is dictionary object in vbscript? Explain?

0 Answers  


Categories