PowerShell: Sort Files by Size 📜

By Xah Lee. Date: . Last updated: .

List Large Files

function xah-list-large-files {

    # .DESCRIPTION
    # list top 200 biggest files in current dir, recursively
    # .EXAMPLE
    #
    # .EXAMPLE
    #
    # .INPUTS
    #
    # .OUTPUTS
    #
    # .NOTES
    # Created: 2024-10-18
    # Version: 2025-09-10
    # .LINK

    # PowerShell: List Large Files
    # http://xahlee.info/powershell/powershell_list_large_files.html

    dir -Recurse -file | sort -Descending -Property length | select -First 200 | ForEach-Object { Write-Host ("{0:n0} {1}" -f $_.length, $_.fullname ); }

}

PowerShell. List Dirs and Files

List Dirs

List Files

Create, Copy, Delete, Dir

Path Tutorial