powershell folder stats

Posted by huppy_doodoo on Stack Overflow See other posts from Stack Overflow or by huppy_doodoo
Published on 2011-02-21T09:13:51Z Indexed on 2011/02/22 7:25 UTC
Read the original article Hit count: 177

Filed under:

Hi all,

I keep all modules of our system in one dir (e.g. All\ModuleA; All\ModuleB). I want to see what types of files are most numerous and take up the most space, by module. So, I'd like output along the lines of:

ModName,java-count,java-size,xml-count,xml-size,png-count,png-size...
ModuleA,30,0.2,100,2.3,0,0,...
ModuleB,21,0.1,20,0.7,1,1.2

Not all modules have files of all types, so this will only work if I list all types for all module (with lots of zeros). I have something that almost works, but it's hideous, verbose and inefficient. I'm sure someone can help me see the light :-) (which, by the way, can be a piece of freeware software that does this out of the box; I only chose to do this in powershell out of interest).

thanks

© Stack Overflow or respective owner

Related posts about powershell