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?

  • I smell XYZ problem here...
    – Hello71
    Jul 21, 2011 at 16:36

1 Answer 1


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)

You must log in to answer this question.

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