![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | determine last time file/folder was modified I found a script on the net that searches a folder for the names of subfolders and files and pumps that information to a log file. I have modified the script to gather more info and to export the data to an Excel spreadsheet. I just wanted to get some feedback on it. Thanks, Jeremy ----------------------------------------------------------------------- 'Purpose of this script is to recursively search a directory 'to return the following info about subfolders and subfiles 'Date Created, Date Last Accessed, Date Last Modified, 'Name, Path, Size and Type. 'And to massage that all into an Excel spread sheet Set objFSO = CreateObject("Scripting.FileSystemObject") Const ForAppending = 2 Dim objFSO:Set objFSO = CreateObject("Scripting.FileSystemObject") 'LogFile = "f:\jeremy-data\documents\exportme.log" 'Dim objLogFile:Set objLogFile = objFSO.CreateTextFile(logfile, 2, True) Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2 objExcel.Cells(1, 1).Value = "Date Created" objExcel.Cells(1, 2).Value = "Date Last Accessed" objExcel.Cells(1, 3).Value = "Date Last Modified" objExcel.Cells(1, 4).Value = "Name" objExcel.Cells(1, 5).Value = "Path" objExcel.Cells(1, 6).Value = "Size" objExcel.Cells(1, 7).Value = "Type" objStartFolder = "f:\jeremy-data\documents\" Set objFolder = objFSO.GetFolder(objStartFolder) 'objLogFile.Write objFolder.Path 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFolder.DateCreated objExcel.Cells(intRow, 2).Value = objFolder.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFolder.DateLastModified objExcel.Cells(intRow, 4).Value = objFolder.Name objExcel.Cells(intRow, 5).Value = objFolder.Path objExcel.Cells(intRow, 7).Value = objFolder.Type intRow = intRow + 1 Set colFiles = objFolder.Files For Each objFile in colFiles ' objLogFile.Write objFile.Name 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFile.DateCreated objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFile.DateLastModified objExcel.Cells(intRow, 4).Value = objFile.Name objExcel.Cells(intRow, 5).Value = objFile.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = objFile.Type intRow = intRow + 1 Next ShowSubfolders objFSO.GetFolder(objStartFolder) Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders 'objLogFile.Write Subfolder.Path 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = subFolder.DateCreated objExcel.Cells(intRow, 2).Value = subFolder.DateLastAccessed objExcel.Cells(intRow, 3).Value = subFolder.DateLastModified objExcel.Cells(intRow, 4).Value = subFolder.Name objExcel.Cells(intRow, 5).Value = subFolder.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = subFolder.Type intRow = intRow + 1 Set objFolder = objFSO.GetFolder(Subfolder.Path) Set colFiles = objFolder.Files For Each objFile in colFiles 'objLogFile.Write objFile.Name 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFile.DateCreated objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFile.DateLastModified objExcel.Cells(intRow, 4).Value = objFile.Name objExcel.Cells(intRow, 5).Value = objFile.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = objFile.Type intRow = intRow + 1 Next ShowSubFolders Subfolder Next End Sub objLogFile.Close wscript.echo "Done!" |
My System Specs![]() |
| | #2 (permalink) |
| | Development of a script to find latest created/modified files on acomputer or in a folder Here is another script I found that finds the latest file - <a href="http://www.biterscripting.com/LearningScripting/Lesson4.html">http://www.biterscripting.com/LearningScripting/Lesson4.html</a> . Look at the bottom of the page for the Script latest.txt . This is actually a tutorial, so he explains how to develop this script (or a similar script) step by step. Jeremy wrote: determine last time file/folder was modified 07-Nov-09 I found a script on the net that searches a folder for the names of subfolders and files and pumps that information to a log file. I have modified the script to gather more info and to export the data to an Excel spreadsheet. I just wanted to get some feedback on it. Thanks, Jeremy ----------------------------------------------------------------------- 'Purpose of this script is to recursively search a directory 'to return the following info about subfolders and subfiles 'Date Created, Date Last Accessed, Date Last Modified, 'Name, Path, Size and Type. 'And to massage that all into an Excel spread sheet Set objFSO = CreateObject("Scripting.FileSystemObject") Const ForAppending = 2 Dim objFSO:Set objFSO = CreateObject("Scripting.FileSystemObject") 'LogFile = "f:\jeremy-data\documents\exportme.log" 'Dim objLogFile:Set objLogFile = objFSO.CreateTextFile(logfile, 2, True) Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add intRow = 2 objExcel.Cells(1, 1).Value = "Date Created" objExcel.Cells(1, 2).Value = "Date Last Accessed" objExcel.Cells(1, 3).Value = "Date Last Modified" objExcel.Cells(1, 4).Value = "Name" objExcel.Cells(1, 5).Value = "Path" objExcel.Cells(1, 6).Value = "Size" objExcel.Cells(1, 7).Value = "Type" objStartFolder = "f:\jeremy-data\documents\" Set objFolder = objFSO.GetFolder(objStartFolder) 'objLogFile.Write objFolder.Path 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFolder.DateCreated objExcel.Cells(intRow, 2).Value = objFolder.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFolder.DateLastModified objExcel.Cells(intRow, 4).Value = objFolder.Name objExcel.Cells(intRow, 5).Value = objFolder.Path objExcel.Cells(intRow, 7).Value = objFolder.Type intRow = intRow + 1 Set colFiles = objFolder.Files For Each objFile in colFiles ' objLogFile.Write objFile.Name 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFile.DateCreated objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFile.DateLastModified objExcel.Cells(intRow, 4).Value = objFile.Name objExcel.Cells(intRow, 5).Value = objFile.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = objFile.Type intRow = intRow + 1 Next ShowSubfolders objFSO.GetFolder(objStartFolder) Sub ShowSubFolders(Folder) For Each Subfolder in Folder.SubFolders 'objLogFile.Write Subfolder.Path 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = subFolder.DateCreated objExcel.Cells(intRow, 2).Value = subFolder.DateLastAccessed objExcel.Cells(intRow, 3).Value = subFolder.DateLastModified objExcel.Cells(intRow, 4).Value = subFolder.Name objExcel.Cells(intRow, 5).Value = subFolder.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = subFolder.Type intRow = intRow + 1 Set objFolder = objFSO.GetFolder(Subfolder.Path) Set colFiles = objFolder.Files For Each objFile in colFiles 'objLogFile.Write objFile.Name 'objLogFile.Writeline objExcel.Cells(intRow, 1).Value = objFile.DateCreated objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed objExcel.Cells(intRow, 3).Value = objFile.DateLastModified objExcel.Cells(intRow, 4).Value = objFile.Name objExcel.Cells(intRow, 5).Value = objFile.Path objExcel.Cells(intRow, 6).Value = objFolder.Size objExcel.Cells(intRow, 7).Value = objFile.Type intRow = intRow + 1 Next ShowSubFolders Subfolder Next End Sub objLogFile.Close Previous Posts In This Thread: EggHeadCafe - Software Developer Portal of Choice Retrieve Hardware Identifiers in C# with WMI http://www.eggheadcafe.com/tutorials...e-identif.aspx |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Development of a script to find latest created/modified files on a Thnaks, the site looks promissing! "Randi R" wrote: Quote: > > Here is another script I found that finds the latest file - <a href="http://www.biterscripting.com/LearningScripting/Lesson4.html">http://www.biterscripting.com/LearningScripting/Lesson4.html</a> . > > Look at the bottom of the page for the Script latest.txt . This is actually a tutorial, so he explains how to develop this script (or a similar script) step by step. > > > > > > Jeremy wrote: > > determine last time file/folder was modified > 07-Nov-09 > > I found a script on the net that searches a folder for the names of > subfolders and files and pumps that information to a log file. I have > modified the script to gather more info and to export the data to an Excel > spreadsheet. I just wanted to get some feedback on it. Thanks, Jeremy > > ----------------------------------------------------------------------- > 'Purpose of this script is to recursively search a directory > 'to return the following info about subfolders and subfiles > 'Date Created, Date Last Accessed, Date Last Modified, > 'Name, Path, Size and Type. > 'And to massage that all into an Excel spread sheet > > Set objFSO = CreateObject("Scripting.FileSystemObject") > Const ForAppending = 2 > Dim objFSO:Set objFSO = CreateObject("Scripting.FileSystemObject") > 'LogFile = "f:\jeremy-data\documents\exportme.log" > 'Dim objLogFile:Set objLogFile = objFSO.CreateTextFile(logfile, 2, True) > > Set objExcel = CreateObject("Excel.Application") > objExcel.Visible = True > objExcel.Workbooks.Add > > intRow = 2 > > objExcel.Cells(1, 1).Value = "Date Created" > objExcel.Cells(1, 2).Value = "Date Last Accessed" > objExcel.Cells(1, 3).Value = "Date Last Modified" > objExcel.Cells(1, 4).Value = "Name" > objExcel.Cells(1, 5).Value = "Path" > objExcel.Cells(1, 6).Value = "Size" > objExcel.Cells(1, 7).Value = "Type" > > objStartFolder = "f:\jeremy-data\documents\" > > Set objFolder = objFSO.GetFolder(objStartFolder) > 'objLogFile.Write objFolder.Path > 'objLogFile.Writeline > objExcel.Cells(intRow, 1).Value = objFolder.DateCreated > objExcel.Cells(intRow, 2).Value = objFolder.DateLastAccessed > objExcel.Cells(intRow, 3).Value = objFolder.DateLastModified > objExcel.Cells(intRow, 4).Value = objFolder.Name > objExcel.Cells(intRow, 5).Value = objFolder.Path > objExcel.Cells(intRow, 7).Value = objFolder.Type > intRow = intRow + 1 > > Set colFiles = objFolder.Files > For Each objFile in colFiles > ' objLogFile.Write objFile.Name > 'objLogFile.Writeline > > objExcel.Cells(intRow, 1).Value = objFile.DateCreated > objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed > objExcel.Cells(intRow, 3).Value = objFile.DateLastModified > objExcel.Cells(intRow, 4).Value = objFile.Name > objExcel.Cells(intRow, 5).Value = objFile.Path > objExcel.Cells(intRow, 6).Value = objFolder.Size > objExcel.Cells(intRow, 7).Value = objFile.Type > intRow = intRow + 1 > > Next > > ShowSubfolders objFSO.GetFolder(objStartFolder) > > Sub ShowSubFolders(Folder) > For Each Subfolder in Folder.SubFolders > 'objLogFile.Write Subfolder.Path > 'objLogFile.Writeline > > objExcel.Cells(intRow, 1).Value = subFolder.DateCreated > objExcel.Cells(intRow, 2).Value = subFolder.DateLastAccessed > objExcel.Cells(intRow, 3).Value = subFolder.DateLastModified > objExcel.Cells(intRow, 4).Value = subFolder.Name > objExcel.Cells(intRow, 5).Value = subFolder.Path > objExcel.Cells(intRow, 6).Value = objFolder.Size > objExcel.Cells(intRow, 7).Value = subFolder.Type > intRow = intRow + 1 > > Set objFolder = objFSO.GetFolder(Subfolder.Path) > Set colFiles = objFolder.Files > > For Each objFile in colFiles > 'objLogFile.Write objFile.Name > 'objLogFile.Writeline > > > objExcel.Cells(intRow, 1).Value = objFile.DateCreated > objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed > objExcel.Cells(intRow, 3).Value = objFile.DateLastModified > objExcel.Cells(intRow, 4).Value = objFile.Name > objExcel.Cells(intRow, 5).Value = objFile.Path > objExcel.Cells(intRow, 6).Value = objFolder.Size > objExcel.Cells(intRow, 7).Value = objFile.Type > intRow = intRow + 1 > Next > ShowSubFolders Subfolder > Next > End Sub > > objLogFile.Close > > Previous Posts In This Thread: > > EggHeadCafe - Software Developer Portal of Choice > Retrieve Hardware Identifiers in C# with WMI > http://www.eggheadcafe.com/tutorials...e-identif.aspx > . > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to get the Last Modified date of a file? | PowerShell | |||
| Last Modified file dates | Vista General | |||
| My folders have lost titles and now show modified time & date. HELP!!! | Vista file management | |||
| Finding who modified a file? | PowerShell | |||
| Cannot select more than one file or folder at a time | Vista General | |||