OS: | Windows | ||||||||||||||||
Type: | A Windows PowerShell script | ||||||||||||||||
Language: | Windows PowerShell | ||||||||||||||||
Description: | Get-DirectorySize returns the size of a directory or directories (paths) specificed by a parameter called -Path and reports the sizes of the first level of folders (i.e. the listing is similar to the common "dir " command, but the size of the folders is shown in the results and the listing of files is omitted).
To query recursively (i.e. including all sub-directories of the sub-directories and their sub-directories as well and also all other successive sub-directories) a parameter -Recurse may be added to the query command.
To effectively use Get-DirectorySize, a path, paths or path names to a directory should be specified (with the -Path parameter), as by default, only $env:temp gets searched. The paths should be valid file system paths to a directory (a full path name of a directory (i.e. folder path such as C:\Windows )). In case the path name includes space characters, quotation marks around the path name are mandatory. The -Path parameter accepts a collection of path names (separated by comma) and also takes an array of strings for paths to query.
The directories are queried extensively, a wide array of properties, such as Directory, Owner, Size, Relative Size (Size (%)), raw_size, File Count, Subfolder Count, Average File Size, Average File Size (B), Written, Written Ago (h), Age (Days), Read, Read ago (h), Created on, Last Updated, BaseName, PSChildName, Last AccessTime, Last WriteTime, Creation Time, Extension, Is ReadOnly, Exists, PS Is Container, Attributes, VersionInfo, Folder Name, Name, Parent, Root, PSParentPath, PSPath, PSProvider, Last WriteTime (UTC), Creation Time (UTC), Last AccessTime (UTC), PSDrive, Volume Available Free Space (B), Volume Type, Volume Free, Volume Free (%), Volume Is Ready, Volume Label, Volume Name, Volume Root Directory, Volume Total Size, Volume Total Free Space (B), Volume Total Size (B), Volume Used, Volume Used (%) and Volume is leveraged from the directories totaling over 50 headers / columns. The full report is written to a CSV-file, about 1/2 of the data is displayed in a sortable pop-up window (Out-GridView) and a Directory Size Report (as a HTML file) with the essential information is invoked in the default browser. The -ReportPath parameter defines where the files are saved. The default save location of the HTML Directory Size Report (directory_size.html ) and the adjacent CSV-file (directory_size.csv ) is $env:temp , which points to the current temporary file location, which is set in the system (– for more information, please see the Notes section).
While the parameters -Path , -Recurse and -ReportPath (along with the -Audio parameter(, which emits an audible beep after the query is finished)) modify holistically the behavior of Get-DirectorySize, the other parameters -Sort and -Descending toggle how and in which way the data is displayed in the HTML Directory Size Report. The usage and behavior of each parameter is discussed in further detail below. This script is based on Martin Pugh's PowerShell script "Get-FolderSizes". |
||||||||||||||||
Homepage: | /~https://github.com/auberginehill/get-directory-size
Short URL: http://tinyurl.com/jjl9wng |
||||||||||||||||
Version: | 1.2 | ||||||||||||||||
Sources: |
|
||||||||||||||||
Downloads: | For instance Get-DirectorySize.ps1. Or everything as a .zip-file. |
📐 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
➡️ |
|
|||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
|
📖 | To open this code in Windows PowerShell, for instance: | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Find a bug? Have a feature request? Here is how you can contribute to this project:
Bugs: | Submit bugs and help us verify fixes. | |
Feature Requests: | Feature request can be submitted by creating an Issue. | |
Edit Source Files: | Submit pull requests for bug fixes and features and discuss existing proposals. |