Hi Everyone. I have developed a script that will display the name and
creation time of files listed in a directory, but I need to display all
files in all subfolders as well. So for example, if I were looping
through the local disk (C:) drive, I would like a list of all files in
all subfolders beyond c:/. I don't need any folder names, just the file
names and creation times.

Here's the script i've come up with so far and a sample of the output
is below as well.

--------------------------------------SCRIPT----------------------------------------------------------

Set objLogParser = CreateObject("MSUtil.LogQuery")
Set objInputFormat =
CreateObject("MSUtil.LogQuery.FileSystemInputFormat")
objInputFormat.Recurse = 0

Set objOutputFormat =
CreateObject("MSUtil.LogQuery.NativeOutputFormat")
objOutputFormat.rtp = -1

strQuery = "SELECT Name, CreationTime INTO output.txt FROM 'C:\*.*' " &
_
"WHERE NOT Attributes LIKE '%D%' ORDER BY CreationTime"
objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat


--------------------------------------END
SCRIPT---------------------------------------------------

----------------------------------------OUTPUT-------------------------------------------------------

Name CreationTime
-------------- -----------------------
NTDETECT.COM 2004-08-03 21:38:34.0
ntldr 2004-08-03 21:59:34.0
pagefile.sys 2006-06-13 11:20:23.166
boot.ini 2006-06-13 11:25:48.544
AUTOEXEC.BAT 2006-06-13 15:38:36.500
IO.SYS 2006-06-13 15:38:36.500
CONFIG.SYS 2006-06-13 15:38:36.500
MSDOS.SYS 2006-06-13 15:38:36.500
ptdebug.txt 2006-06-14 09:28:37.199
test1.csv 2006-06-15 14:23:30.981
tmp.drf 2006-08-04 01:53:32.731
sqmnoopt00.sqm 2006-09-26 13:20:59.183
sqmdata00.sqm 2006-09-26 13:20:59.183
sqmnoopt01.sqm 2006-09-26 14:33:36.575
sqmdata01.sqm 2006-09-26 14:33:36.595
sqmnoopt02.sqm 2006-09-27 08:15:13.800
sqmdata02.sqm 2006-09-27 08:15:14.922
sqmnoopt03.sq 2006-10-02 08:17:45.566
sqmdata03.sqm 2006-10-02 08:17:45.616

----------------------------------------END
OUTPUT---------------------------------------------------

If anybody has any suggestions, it would be greatly appreciated. Thanks
so much.

Justin Fancy

Re: Include all files in subfolders by Gino

Gino
Wed Nov 08 16:43:19 CST 2006

This script searches thru all folders and subfolders recursively
from any starting point ex. c:\ or c:\folder or c:\folder\subfolder
and lists the files found.
You can get the date thru the property 'file.DateCreated'

Const FOR_READING = 1
strFolder = "c:\" 'starting point

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
Set colFiles = objFolder.Files
For Each objFile In colFiles
WScript.Echo objFile.Path
Next
ShowSubFolders(objFolder)

Sub ShowSubFolders(objFolder)
Set colFolders = objFolder.SubFolders
For Each objSubFolder In colFolders
Set colFiles = objSubFolder.Files
For Each objFile In colFiles
WScript.Echo objFile.Path
Next
ShowSubFolders(objSubFolder)
Next
End Sub

"Justin" <justinfancy@gmail.com> wrote in message
news:1162995263.274327.278060@b28g2000cwb.googlegroups.com...
> Hi Everyone. I have developed a script that will display the name and
> creation time of files listed in a directory, but I need to display all
> files in all subfolders as well. So for example, if I were looping
> through the local disk (C:) drive, I would like a list of all files in
> all subfolders beyond c:/. I don't need any folder names, just the file
> names and creation times.
>
> Here's the script i've come up with so far and a sample of the output
> is below as well.
>
> --------------------------------------SCRIPT----------------------------------------------------------
>
> Set objLogParser = CreateObject("MSUtil.LogQuery")
> Set objInputFormat =
> CreateObject("MSUtil.LogQuery.FileSystemInputFormat")
> objInputFormat.Recurse = 0
>
> Set objOutputFormat =
> CreateObject("MSUtil.LogQuery.NativeOutputFormat")
> objOutputFormat.rtp = -1
>
> strQuery = "SELECT Name, CreationTime INTO output.txt FROM 'C:\*.*' " &
> _
> "WHERE NOT Attributes LIKE '%D%' ORDER BY CreationTime"
> objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat
>
>
> --------------------------------------END
> SCRIPT---------------------------------------------------
>
> ----------------------------------------OUTPUT-------------------------------------------------------
>
> Name CreationTime
> -------------- -----------------------
> NTDETECT.COM 2004-08-03 21:38:34.0
> ntldr 2004-08-03 21:59:34.0
> pagefile.sys 2006-06-13 11:20:23.166
> boot.ini 2006-06-13 11:25:48.544
> AUTOEXEC.BAT 2006-06-13 15:38:36.500
> IO.SYS 2006-06-13 15:38:36.500
> CONFIG.SYS 2006-06-13 15:38:36.500
> MSDOS.SYS 2006-06-13 15:38:36.500
> ptdebug.txt 2006-06-14 09:28:37.199
> test1.csv 2006-06-15 14:23:30.981
> tmp.drf 2006-08-04 01:53:32.731
> sqmnoopt00.sqm 2006-09-26 13:20:59.183
> sqmdata00.sqm 2006-09-26 13:20:59.183
> sqmnoopt01.sqm 2006-09-26 14:33:36.575
> sqmdata01.sqm 2006-09-26 14:33:36.595
> sqmnoopt02.sqm 2006-09-27 08:15:13.800
> sqmdata02.sqm 2006-09-27 08:15:14.922
> sqmnoopt03.sq 2006-10-02 08:17:45.566
> sqmdata03.sqm 2006-10-02 08:17:45.616
>
> ----------------------------------------END
> OUTPUT---------------------------------------------------
>
> If anybody has any suggestions, it would be greatly appreciated. Thanks
> so much.
>
> Justin Fancy
>



Re: Include all files in subfolders by Walter

Walter
Thu Nov 09 06:19:03 CST 2006

objInputFormat.Recurse = -1

You currently have 0 as the value. 0 means no recursion,1 means to go 1 deep
thru subfolders, 2 means 2 deep, etc...., and -1 means unlimited recursion.

"Justin" <justinfancy@gmail.com> wrote in message
news:1162995263.274327.278060@b28g2000cwb.googlegroups.com...
> Hi Everyone. I have developed a script that will display the name and
> creation time of files listed in a directory, but I need to display all
> files in all subfolders as well. So for example, if I were looping
> through the local disk (C:) drive, I would like a list of all files in
> all subfolders beyond c:/. I don't need any folder names, just the file
> names and creation times.
>
> Here's the script i've come up with so far and a sample of the output
> is below as well.
>
> --------------------------------------SCRIPT----------------------------------------------------------
>
> Set objLogParser = CreateObject("MSUtil.LogQuery")
> Set objInputFormat =
> CreateObject("MSUtil.LogQuery.FileSystemInputFormat")
> objInputFormat.Recurse = 0
>
> Set objOutputFormat =
> CreateObject("MSUtil.LogQuery.NativeOutputFormat")
> objOutputFormat.rtp = -1
>
> strQuery = "SELECT Name, CreationTime INTO output.txt FROM 'C:\*.*' " &
> _
> "WHERE NOT Attributes LIKE '%D%' ORDER BY CreationTime"
> objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat
>
>
> --------------------------------------END
> SCRIPT---------------------------------------------------
>
> ----------------------------------------OUTPUT-------------------------------------------------------
>
> Name CreationTime
> -------------- -----------------------
> NTDETECT.COM 2004-08-03 21:38:34.0
> ntldr 2004-08-03 21:59:34.0
> pagefile.sys 2006-06-13 11:20:23.166
> boot.ini 2006-06-13 11:25:48.544
> AUTOEXEC.BAT 2006-06-13 15:38:36.500
> IO.SYS 2006-06-13 15:38:36.500
> CONFIG.SYS 2006-06-13 15:38:36.500
> MSDOS.SYS 2006-06-13 15:38:36.500
> ptdebug.txt 2006-06-14 09:28:37.199
> test1.csv 2006-06-15 14:23:30.981
> tmp.drf 2006-08-04 01:53:32.731
> sqmnoopt00.sqm 2006-09-26 13:20:59.183
> sqmdata00.sqm 2006-09-26 13:20:59.183
> sqmnoopt01.sqm 2006-09-26 14:33:36.575
> sqmdata01.sqm 2006-09-26 14:33:36.595
> sqmnoopt02.sqm 2006-09-27 08:15:13.800
> sqmdata02.sqm 2006-09-27 08:15:14.922
> sqmnoopt03.sq 2006-10-02 08:17:45.566
> sqmdata03.sqm 2006-10-02 08:17:45.616
>
> ----------------------------------------END
> OUTPUT---------------------------------------------------
>
> If anybody has any suggestions, it would be greatly appreciated. Thanks
> so much.
>
> Justin Fancy
>



Re: Include all files in subfolders by Justin

Justin
Thu Nov 09 07:35:49 CST 2006

Ok that works fine. Change of plans. I need to modify this to ouput the
root directory names, and the number of files from 95, from 96, 97 and
all the way till 2006, while still searching through all subfolders and
subdirectories

So here's a sample of the output imagined:

c:/windows
1995: 20
1996: 30
1997: 0
1998: 100
1999: 200
2000: 89

And all the way to 2006 for every root directory
Any Ideas?

J