Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am seeking to understand that "average" file size for a folder on my computer. I have calculated the true average of files (total size / no. of files), however I would, ultimately, love to group together files into file-size categories as follows;

Files < 1kb: 23 files.
Files < 100kb: 276 files.
Files < 1mb: 786 files.

Is this possible using a batch script?

share|improve this question
I smell XYZ problem here... – Hello71 Jul 21 '11 at 16:36

Yes this is possible.

You will need to write some code that follows along an algorithm of your choice, using variables to store values.

The algorithm could look perform actions like this:

  • define File-Size-Range-Groups ( < 1kb, < 100 kb, etc )
  • Sum the number of files in each File-Size-Range-Group
  • Sum the individual file sizes for a File-Size-Range-Group total
  • Output the sum value of files in a File-Size-Range-Group
  • Output the average (total file size sum for File-Size-Range-Group / number of files in File-Size-Range-Group)
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .