Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion determine last time file/folder was modified
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeremy  
View profile  
 More options Nov 7 2009, 1:21 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Jeremy <Jer...@discussions.microsoft.com>
Date: Sat, 7 Nov 2009 05:21:01 -0800
Local: Sat, Nov 7 2009 1:21 pm
Subject: 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!"


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google