Skip to main content

This command displays the Minimum, Maximum, and Sum of the sizes of all files in the current directory, and the average size of a file in the directory. Also see Get Directory Size PowerShell Script.

##
# Measure the files in a directory
#
# This command displays the Minimum, Maximum, and Sum of the sizes of all files
# in the current directory, and the average size of a file in the directory.
#
# The Measure-Object cmdlet calculates the property values of certain types of
# object. Measure-Object performs three types of measurements, depending on the
# parameters in the command.
#
# The Measure-Object cmdlet performs calculations on the property values of
# objects. You can use Measure-Object to count objects or count objects with a
# specified Property. You can also use Measure-Object to calculate the Minimum,
# Maximum, Sum, StandardDeviation and Average of numeric values. For String
# objects, you can also use Measure-Object to count the number of lines, words,
# and characters.
#
# Source: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/measure-object?view=powershell-7.2#example-2-measure-the-files-in-a-directory
##

PS > Get-ChildItem | Measure-Object -Property length -Minimum -Maximum -Sum -Average
Count             : 14
Average           : 28463246
Sum               : 398485444
Maximum           : 108749194
Minimum           : 95
StandardDeviation :
Property          : length