• Sign In
 
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...
Common Tasks
  • Blog Home
  • Email Blog Author
  • RSS for comments
  • RSS for posts
Search
  • Advanced search options...
Tags
  • .NET Framewor
  • .NET Framework
  • Ajax/Javascript
  • ASP.NET
  • CLR
  • Cool stuff
  • DataAccess
  • Debugging/Windbg
  • Hotfix/Service Pack
  • IDEVDataCollector
  • IIS
  • Internet Explorer
  • Italian techs
  • LogParser
  • OT
  • Personal
  • Productivity
  • Random
  • Scripting/ASP
  • Security
  • Technology
  • Tools
  • Troubleshooting
  • Vista/Longhorn
  • Visual Studio
Archives
Archives
  • November 2010 (1)
  • October 2010 (1)
  • July 2010 (2)
  • April 2010 (1)
  • March 2010 (2)
  • February 2010 (2)
  • January 2010 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (1)
  • July 2009 (5)
  • June 2009 (1)
  • May 2009 (1)
  • April 2009 (3)
  • March 2009 (3)
  • February 2009 (5)
  • January 2009 (3)
  • December 2008 (5)
  • November 2008 (3)
  • October 2008 (2)
  • September 2008 (3)
  • August 2008 (3)
  • July 2008 (3)
  • June 2008 (5)
  • May 2008 (4)
  • April 2008 (8)
  • March 2008 (4)
  • February 2008 (5)
  • January 2008 (2)
  • December 2007 (4)
  • November 2007 (6)
  • October 2007 (6)
  • September 2007 (8)
  • August 2007 (6)
  • July 2007 (7)
  • June 2007 (10)
  • May 2007 (9)
  • April 2007 (12)
  • March 2007 (8)
  • February 2007 (5)
  • January 2007 (3)
  • December 2006 (1)
  • November 2006 (4)
  • October 2006 (2)
  • September 2006 (9)
  • August 2006 (2)
  • July 2006 (1)

Find folder size (conditionally) with LogParser

MSDN Blogs > Never doubt thy debugger > Find folder size (conditionally) with LogParser

Find folder size (conditionally) with LogParser

Carlo Cardella
31 Aug 2007 10:18 AM
  • Comments 6

I was reading this post from Rahul a few days ago, and wondered if something similar could have been done (hopefully with less efforts) with LogParser... Well, it turned our that LogParser accepts a "-FS" switch which stands for File System as the input type, and if you run "logparser -h examples" you'll have a few sample commands you can use as the basis of your scripts. And guess what? Here's one of them:

Print the 10 largest files on the C: drive:
LogParser "SELECT TOP 10 * FROM C:\*.* ORDER BY Size DESC" -i:FS

I created a similar structure and put in there some sample images, just to have some files to count:

folder tree

So... here's the script:

logparser "SELECT SUM(Size) FROM c:\temp\Rahul\*.* WHERE INDEX_OF(Path, '_wow') > 0" -i:FS

And the output:

logparser output

5 images, 35.391 bytes each = 179.655 bytes... here we are! smile_regular

Carlo


Quote of the Day:
It is a great thing to start life with a small number of really good books which are your very own.
--Sir Arthur Conan Doyle

  • 6 Comments
LogParser
Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post
Comments
  • imRahulSoni
    31 Aug 2007 11:06 AM

    That's very cool!! Thanks's for sharing it :-)

  • Daniele Muscetta
    31 Aug 2007 3:40 PM

    LogParser is a sort of "hidden jewel" that not enough people know about.

    As of myself, I am *aware* it exists and that it is very powerful, but I rarely remember to resort to it - my bad, my bad!!!

    Lately I have much more busy with PowerShell... but until powershell gets installed on every machine, these other small and powerful tools come in very handy (I am thinking of machines owned by customers...).

    Thanks a for a lot of useful posts, man!!

  • Johannes Hansen
    4 Sep 2007 7:04 AM

    LogParser is an awesome tool but for this particular task (finding large files, summing folder sizes etc.) I think i would go with PowerShell since it is far more flexible.

  • Carlo Cardella
    4 Sep 2007 8:17 AM

    Yes, sure... take this as a sort of "virtuosity exercise" with the tool :-)

  • A developer's strayings
    11 Sep 2007 4:27 PM

    When I joint Microsoft and the EMEA Internet Dev Support Team in late 2004, I soon realized that I had

  • Noticias externas
    11 Sep 2007 4:40 PM

    When I joint Microsoft and the EMEA Internet Dev Support Team in late 2004, I soon realized that I had

Page 1 of 1 (6 items)
  • © 2012 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy Statement
  • Report Abuse
  • 5.6.402.223