Find Large Space Consuming Folders on your System

This script finds large folders on your system, and displays the amount of space being consumed by them.

4 Star
Add to favorites
E-mail Twitter Digg Facebook
  • Folder level limits
    5 Posts | Last post September 25, 2012
    • Love the script, but is there a way to limit how many levels it does? Example is lets say I as a server admin want a report of the folder sizes for the user home drives on a server. First helps limit it, but I dont want the list to get hung up on a single user that has a lot of large folders.  Thanks
    • Check line 68 where it says:
      Select-Object -Property folder, size -First $first |
      Check what -First does:
      Get-Help Select-Object -Full
      -First <int>
          Specifies the number of objects to select from the beginning of an array of input objects.
          Required?                    false
          Position?                    named
          Default value
          Accept pipeline input?       false
          Accept wildcard characters?  false
      Just remove the -First on line 68, remove "[int]$first = 5" on line 9 and the "," on line 8.
      This will not give you 5 results, but will loop through all folders.
    • When I run this script I get a bunch of these:
      Get-Item : Could not find item C:\Documents and Settings\guest\Application Data.
      At C:\Documents and Settings\Administrator\My Documents\Find Large Folders.ps1:33 char:42
      +                          -Value (Get-Item <<<<  $path).FullName
          + CategoryInfo          : ObjectNotFound: (C:\Documents an...pplication Data:String) [Get-Item], IOException
          + FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.GetItemCommand
    • I receive the same error as racoozie, I am sure it is to do with that Powershell does not deal with spaces in folder names i.e. ...\Documents and Settings\...usually you add an & if you are running a script with a space like this [& 'C:\Scripts folder\script.ps1']. In the script I tried [string]$path = &"c:\ ", but just get Missing expression after '='. error. Do not have a solution as yet. Any help would be appreciated.
    • remove the ' in line 32 and make it look like this
      $object | Add-Member -MemberType NoteProperty -Name Folder -Value (Get-Item $path).FullName 
  • How Can I solve this error?
    1 Posts | Last post October 18, 2011
      PS F: \> &. '\ Folder_size (new). Ps1'
      Missing expression after unary operator '-'.
      In F: \ folder_size (new). Ps1: 33 character: 27
      + - <<<<Value (Get-Item $ path). FullName
           + CategoryInfo: ParserError: (-: String) [], ParseException
           + FullyQualifiedErrorId: MissingExpressionAfterOperator
      PS F: \>