4

Is there any way to calculate, and breakdown, average file sizes for a given directory (or drive)?

Something that can give details such as:|

  • Files of 4KB - 22KB: account to 20% of all files
  • Files of 32KB - 64KB: account to 10% of all files
  • Files of 1MB - 20MB: account to 70% of all files

And so on.

Perhaps you know of a utility that can do that?

7

You can do this pretty easily in Powershell

$foo = (Get-ChildItem -path "c:\your\file\path" -recurse | measure-object | select -expand Count)
$bar = ((Get-ChildItem -path "c:\your\file\path" -recurse | Measure-Object -property length -sum).sum /1MB)
$avrg = $bar / $foo
$avrg

Output example:

PS X:\> $avrg
1.03643417358398
2
  • the first line can be shortened to (ls "c:\your\file\path" -r | measure-object).Count – phuclv Dec 6 '18 at 8:18
  • Note that $foot is the number of files and $bar is the total size of all the files in MB. Also, you can calculate the size of files with only a certain extension by putting a *.ext at the end of the both (both paths need to be modified) – robertspierre Jul 4 '19 at 11:29
1

Someone over at Seven Forums pointed me out to Agent Ransack from Mythicsoft:

http://www.mythicsoft.com/page.aspx?type=agentransack&page=home

Had to make the calculations on my own but it wasn't so bad.

1

I just used total commander (shareware) and microsoft excel to do that in 2 minutes.

In Total Commander go to the root of C: (or any drive you like) click Ctrl+B, which lists all files within all subdirectories in one place. From Mark menu item, click "Copy to clipboard with all details" and paste into excel... you now have a long list of items with their file sizes, sort and count to your hearts content. You can also Google "histogram in Excel" for a nicer output.

What I ended up with on a one-year-old Windows 8.1 system is shown below (sizes are in bytes, and the x axis figures are my defined range). As one can see majority of my files are around 1k range.

The x axis figures are my defined range

0

Maybe this is helpful?

It is slow but acurate, don't know for shure if it avarages files in a directory.

1
  • Thanks but I have already tried it. It doesn't report the information I need - the closest it get's is dividing the folder contents by file extension which is irrelevant for me – pilau Nov 1 '12 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.