I have a series of folders that are backed up every night using xcopy. I want to be able to run a script to report the newest filename and DateLastModified of the files in each of a number of folders. I have found an example of a script that shows me the newest file and its date/timestamp but I want to iterate through a number of folders and subfolders and report each newest entry into a log file.
Below is the example for checking the newest file in r:\server1\oracle\instance1\Archive. I also want to get teh newest file for ..\instance1\Rman and ..\instance1\Folder3 etc.
set oFolder=createobject("scripting.filesystemobject").getfolder("r:\server1\oracle\instance1\Archive")
For Each aFile In oFolder.Files
If sNewest = "" Then
Set fNewest = aFile
sNewest = aFile.Name
Else
If fNewest.DateCreated < aFile.DateCreated Then
Set fNewest = aFile
End If
End If
Next
Msgbox fNewest.Name & " " & fNewest.DateLastModified
I guess the output of the file should look like:
r:\server1\oracle\instance1\Archive\fileabc.dat 06/04/2010 01:01:27
r:\server1\oracle\instance1\Rman\file123.dat 06/04/2010 01:05:27
r:\server1\oracle\instance2\Archive\ffff.dat 06/04/2010 02:01:27
Any help would be greatly appreciated.
Below is the example for checking the newest file in r:\server1\oracle\instance1\Archive. I also want to get teh newest file for ..\instance1\Rman and ..\instance1\Folder3 etc.
set oFolder=createobject("scripting.filesystemobject").getfolder("r:\server1\oracle\instance1\Archive")
For Each aFile In oFolder.Files
If sNewest = "" Then
Set fNewest = aFile
sNewest = aFile.Name
Else
If fNewest.DateCreated < aFile.DateCreated Then
Set fNewest = aFile
End If
End If
Next
Msgbox fNewest.Name & " " & fNewest.DateLastModified
I guess the output of the file should look like:
r:\server1\oracle\instance1\Archive\fileabc.dat 06/04/2010 01:01:27
r:\server1\oracle\instance1\Rman\file123.dat 06/04/2010 01:05:27
r:\server1\oracle\instance2\Archive\ffff.dat 06/04/2010 02:01:27
Any help would be greatly appreciated.