Uncategorized

Find folder size (conditionally) with LogParser

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
folder

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
logparser output

5 images, 35.391 bytes each = 179.655 bytes… here we are! ?

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.