Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to find a latest file from any folder

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to Import data from a file (file is on the desktop) to the data table

2129


How will you get the last occurrence of one string within another string using vbscript?

1244


How can you destroy an object in vbscript?

1170


Mention what is the main difference between function and sub-procedure?

1108


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

1276


How to get the length of the string by making use of the string function?

1127


how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me

1893


What is Procedure or Subroutine in VB Script?

1209


how to increasing the numbers in a given text box please write a vb script

2262


Explain the constants in vbscript?

1044


How do you declare a variable in vbscript?

1117


Write a vbscript procedure that converts feet to inches. Hint: there are 12 inches in a foot?

1098


Explain the string concatenation function in vbscript?

1100


Dear All, I am geting below IE error whilie executing the QTP scripts in Batch mode "Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience." can any one suggest me how to resolve this issue . Thanks Balaji

1770


write a function to read the items from combobox of Flight reservation & save in excel (QTP)??

2898