How do I find the 10 largest files in a directory structure?
Powershell – How to find the 10 largest files in a directory structure
powershell
Related Topic
- Powershell – What’s the best way to determine the location of the current PowerShell script
- Powershell – How to quietly remove a directory with content in PowerShell
- Powershell – How to search a string in multiple files and return the names of files in Powershell
- Powershell – How to get the current directory of the cmdlet being executed
- Powershell – How to concatenate strings and variables in PowerShell
- Sql – How Do I create a log using performance monitor in SQL
Best Answer
Try this script
Breakdown:
The filter block "
?{ -not $_.PSIsContainer }
" is meant to filter out directories. The sort command will sort all of the remaining entries by size in descending order. The select clause will only allow the first 10 through so it will be the largest 10.