Hi All,
First off let me say thanks in advance for taking a look. I have been messing around with the code below that I put together for a few different sources. I'm a Newbie, so knowledge is limited. The end goal is I need a script that sets a root folder and looks through *only folders) under the root. It needs to then compare the DateCreated to current date - xdays and if it meets the criteria output the obj DateCreated and Name to a file.
So the criteria is:
#1 - Loop to evaluate each subfolder under the root folder
#2 - Evaluate the DateCreated against current date - xdays
#3 - Output DateCreated/Name if it meets critera.
Any help would be appreciated. What I have so far is below:
First off let me say thanks in advance for taking a look. I have been messing around with the code below that I put together for a few different sources. I'm a Newbie, so knowledge is limited. The end goal is I need a script that sets a root folder and looks through *only folders) under the root. It needs to then compare the DateCreated to current date - xdays and if it meets the criteria output the obj DateCreated and Name to a file.
So the criteria is:
#1 - Loop to evaluate each subfolder under the root folder
#2 - Evaluate the DateCreated against current date - xdays
#3 - Output DateCreated/Name if it meets critera.
Any help would be appreciated. What I have so far is below:
Code:
'Set Root Folder to Search
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFolder("C:\testfolder")
'Open file for logging
Dim ObjFso1
Dim StrFileName
Dim ObjFile1
StrFileName = "C:\output.log"
Set ObjFso1 = CreateObject("Scripting.FileSystemObject")
'Creating a file for writing data
Set ObjFile1 = ObjFso1.CreateTextFile(StrFileName)
Wscript.Echo "Date created: " & objFile.DateCreated
Wscript.Echo "Date last accessed: " & objFile.DateLastAccessed
Wscript.Echo "Date last modified: " & objFile.DateLastModified
Wscript.Echo "Drive: " & objFile.Drive
Wscript.Echo "Name: " & objFile.Name
Wscript.Echo "Parent folder: " & objFile.ParentFolder
Wscript.Echo "Path: " & objFile.Path
Wscript.Echo "Short name: " & objFile.ShortName
Wscript.Echo "Short path: " & objFile.ShortPath
Wscript.Echo "Size: " & objFile.Size
Wscript.Echo "Type: " & objFile.Type
ObjFile1.WriteLine(objFile.Name)
ObjFile1.WriteLine(objFile.DateCreated)
WScript.Quit
'Closing the file
ObjFile1.Close