HighTechTalks DotNet Forums  

Using LogParser to find all files > 200k

Dotnet Scripting microsoft.public.dotnet.scripting


Discuss Using LogParser to find all files > 200k in the Dotnet Scripting forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
simon
 
Posts: n/a

Default Using LogParser to find all files > 200k - 10-05-2005 , 12:47 PM






I'd like to user logparser to search recursively from a starting directory
for all files greater than 200k. Then save the file name, path and date to
an html file. I've see where users have used the Top 10 command which I can
replicate, but I'm having difficulty doing a search that lists the files if
file > 200k.
Thanks in advance,

Simon



Reply With Quote
  #2  
Old   
AJ
 
Posts: n/a

Default Re: Using LogParser to find all files > 200k - 10-30-2005 , 10:44 AM






Simon,
There are many ways you can do this:
1) You may find the following code meets your needs. It is taken from the
following link on the Scripting site
http://www.microsoft.com/technet/com...ts/sg0105.mspx

Set objLogParser = CreateObject("MSUtil.LogQuery")
Set objInputFormat = _
CreateObject("MSUtil.LogQuery.FileSystemInputForma t")
objInputFormat.recurse = 0

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

strQuery = "SELECT Name, Size FROM 'C:\Scripts\*.*' ORDER BY Name ASC"
objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat

2)You may also want to explore the use of WMI especially when you want to
run this operation on a remote computer. (you could change the strTarget
value to the name of the remote computer to return data from a remote
computer).

strTarget="."
set objWMIService=GetObject("winmgmts:" & "!\\" & strTarget & "\root\cimv2")
set colResultSet=objWMIService.ExecQuery("SELECT * from CIM_DataFile WHERE
FileSize>104857600 AND Drive='c:'")
for each objResult in colResultSet
WScript.echo objResult.FileName, objResult.FileType, objResult.FileSize
next

Hope this helps

AJ
"simon" <zlynt (AT) yahoo (DOT) com> wrote

Quote:
I'd like to user logparser to search recursively from a starting directory
for all files greater than 200k. Then save the file name, path and date to
an html file. I've see where users have used the Top 10 command which I
can replicate, but I'm having difficulty doing a search that lists the
files if file > 200k.
Thanks in advance,

Simon





Reply With Quote
  #3  
Old   
AJ
 
Posts: n/a

Default Re: Using LogParser to find all files > 200k - 10-31-2005 , 09:19 AM



Forgot to mention that for the LogParser script to work recursively, you
need to leave out the line:
objInputFormat.recurse=0
Logparser does recursion by default unless the recurse property is set to
zero.

This is also mentioned on the Scripting Site and LogParser Documentation.

I would still recommend the WMI option for flexible querying and use of
LogParser on the resulting data

"AJ" <AJ (AT) community (DOT) nospam> wrote

Quote:
Simon,
There are many ways you can do this:
1) You may find the following code meets your needs. It is taken from the
following link on the Scripting site
http://www.microsoft.com/technet/com...ts/sg0105.mspx

Set objLogParser = CreateObject("MSUtil.LogQuery")
Set objInputFormat = _
CreateObject("MSUtil.LogQuery.FileSystemInputForma t")
objInputFormat.recurse = 0

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

strQuery = "SELECT Name, Size FROM 'C:\Scripts\*.*' ORDER BY Name ASC"
objLogParser.ExecuteBatch strQuery, objInputFormat, objOutputFormat

2)You may also want to explore the use of WMI especially when you want to
run this operation on a remote computer. (you could change the strTarget
value to the name of the remote computer to return data from a remote
computer).

strTarget="."
set objWMIService=GetObject("winmgmts:" & "!\\" & strTarget &
"\root\cimv2")
set colResultSet=objWMIService.ExecQuery("SELECT * from CIM_DataFile WHERE
FileSize>104857600 AND Drive='c:'")
for each objResult in colResultSet
WScript.echo objResult.FileName, objResult.FileType, objResult.FileSize
next

Hope this helps

AJ
"simon" <zlynt (AT) yahoo (DOT) com> wrote in message
news:ekrfuxcyFHA.2880 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
I'd like to user logparser to search recursively from a starting
directory for all files greater than 200k. Then save the file name, path
and date to an html file. I've see where users have used the Top 10
command which I can replicate, but I'm having difficulty doing a search
that lists the files if file > 200k.
Thanks in advance,

Simon







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.