GetSizeDistributionValue

Description

Provides you the allocated space or the size and number of files for one of the Size Distribution bar charts.

Syntax

GetSizeDistributionValue (FolderID : <Integer>, Index : <Shortint>, [out]OccupiedSize : <OLEVariant>, [out]NumFiles : <OLEVariant>)

Parameters

FolderID

The ID referring to the directory for which the “Age of Files” values should be retrieved. You get this ID from the functions RootFolderID, FirstChildID or NextSiblingID.

Index

The index of the “Age of Files” bar to export. The first index is always 0. The last index is always (SizeDistributionCount-1).

[out]OccupiedSize

(Out Parameter) The space occupied by all files of this “Size Distribution” interval. By default the value returns the allocated space. In order to return the real size the ViewType option has to be set to “2” (see Example below).

[out]NumFiles

(Out Parameter) The number of files of this “Size Distribution” interval.

Example

1.)

PowerShell:

$RootDirectoryID = $SOS.RootFolderID
$SOS.SizeUnit = "MB"
for(($Index = 0);($Index -lt $SOS.SizeDistributionCount);($Index++))
{
    $SOS.GetSizeDistributionValue($RootDirectoryID, $Index, $AllocatedSpace, $NumberOfFiles);
}

VBS:

RootDirectoryID = SOS.RootFolderID
SOS.SizeUnit = "MB"
Index = 0
Do While Index < SOS.SizeDistributionCount
    SOS.GetSizeDistributionValue RootDirectoryID, Index, AllocatedSpace, NumberOfFiles
    ...
    Index = Index+1
Loop

Loops over all “Size Distribution” intervals of the currently activated root directory and queries the allocated space in MB and the number of files for each single interval.

2.)

PowerShell:

$RootDirectoryID = $SOS.RootFolderID
$SOS.SizeUnit = "Bytes"
$SOS.SetOption("ViewType", "2") # 2 = Real size, 3 = Allocated size (default)
for(($Index = 0);($Index -lt $SOS.SizeDistributionCount);($Index++))
{
    $SOS.GetSizeDistributionValue($RootDirectoryID, $Index, $AllocatedSpace, $NumberOfFiles);
}

VBS:

RootDirectoryID = SOS.RootFolderID
SOS.SizeUnit = "Bytes"
SOS.SetOption "ViewType", "2"  ' 2 = Real size, 3 = Allocated size (default)
Index = 0
Do While Index < SOS.SizeDistributionCount
    SOS.GetSizeDistributionValue RootDirectoryID, Index, AllocatedSpace, NumberOfFiles
    ...
    Index = Index+1
Loop

Loops over all “Size Distribution” intervals of the currently activated root directory and queries the size in Bytes and the number of files for each single interval.