PSFolderSize | get folder sizes and export information | Command Line Interface library
kandi X-RAY | PSFolderSize Summary
kandi X-RAY | PSFolderSize Summary
This module will allow you to get folder sizes and export information easily via PowerShell
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PSFolderSize
PSFolderSize Key Features
PSFolderSize Examples and Code Snippets
Install-Module PSFolderSize
Import-Module .\path\to\PSFolderSize.psd1
Import-Module .\path\to\FolderModuleFilesAreIn
Get-Help Get-FolderSize -Detailed
Community Discussions
Trending Discussions on PSFolderSize
QUESTION
I am new to PowerShell scripting. For one of my School project I need to generate a report of the entire D Drive. I need to list all the folders sorted according to the size
Summary of the work I have done so far: I have installed a PowerShell module from this website https://www.gngrninja.com/script-ninja/2016/5/24/powershell-calculating-folder-sizes using Install-Module PSFolderSize
After installing if I run the command Get-FolderSize I'm getting the FolderSize for the path I'm running from. The foldersize is not running for all the folders in the directory. I am facing difficulty traversing through all the folders.
Expected Output:
...ANSWER
Answered 2019-Oct-21 at 06:23I would use other tools (like TreeSize) for creating reports like this because of the speed and long filename problematics.
However you could solve your task with the following powershell command without downloading an other Module.
For each subfolder inside your D:\ you have to receive your required data.
You have to calculate the size of each directory by looking for each file Get-ChildItem -Path $Folder.FullName -Recurse -Force
and sum up the lenght of all files.
Here you can use the Measure-Object -Property Length -Sum
. Depending on the directory size this task will take some time.
Take a look here if you struggle with long file name issues.
After collection and adding all data to an output variable use Select-Object -Property 'FolderName', 'Size(Bytes)', 'Size(MB)', 'Size(GB)', 'FullPath', 'HostName'
for sorting the header order.
The command Sort-Object -Property 'Size(Bytes)', 'FolderName'
will sort the output depending on the folder size and name.
For a nice looking output use Format-Table
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PSFolderSize
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page