Hello friends!!
Here is a brief code for getting latest/newest file in a particular folder/directory...
Dim LatestFile
Set oFolder=CreateObject("scripting.FileSystemObject").GetFolder("E:\Dwnld")
For Each eachFile In oFolder.Files
If LatestFile = "" Then
Set LatestFile = eachFile
Else If LatestFile.DateCreated < eachFile.DateCreated Then
Set LatestFile = eachFile
End If
End If
Next
Msgbox LatestFile.Name
Here is a brief code for getting latest/newest file in a particular folder/directory...
Dim LatestFile
Set oFolder=CreateObject("scripting.FileSystemObject").GetFolder("E:\Dwnld")
For Each eachFile In oFolder.Files
If LatestFile = "" Then
Set LatestFile = eachFile
Else If LatestFile.DateCreated < eachFile.DateCreated Then
Set LatestFile = eachFile
End If
End If
Next
Msgbox LatestFile.Name
In this blog, I will show you how to find the latest file or folder in particular path.visit here Super.An informative one. It is a new information for me. It help me to know about it. Thanks for sharing this information.
ReplyDelete