04-26-2010, 05:02 PM
Hi Vimal,
Hope you can make use of this:
Hope you can make use of this:
Code:
Option Explicit
Dim objFSO, objFile, objFolder, FolderToScan
Dim c, i, j
FolderToScan = "D:\EricData\vbs"
Set objFSO = CreateObject("Scripting.fileSystemObject")
Set objFolder = objFSO.GetFolder(FolderToScan)
Dim arrFileName(), arrFileDateLastModified()
c = 0
For Each objFile In objFolder.Files
c = c + 1
ReDim Preserve arrFileName(c)
arrFileName(c) = objFile.Name
ReDim Preserve arrFileDateLastModified(c)
arrFileDateLastModified(c) = objFile.DateLastModified
Next
For i = 1 To c
For j = i + 1 To c
If arrFileDateLastModified(i) < arrFileDateLastModified(j) Then
SwapValues arrFileName(i), arrFileName(j)
SwapValues arrFileDateLastModified(i), arrFileDateLastModified(j)
End If
Next
Next
For i = 1 To c
MsgBox "File: " & arrFileName(i) & " Last mod: " & arrFileDateLastModified(i)
Next
Sub SwapValues(ByRef v1, ByRef v2)
Dim vTemp
vTemp = v1
v1 = v2
v2 = vTemp
End Sub