PowerShell: Sort Files by File Size 🚀

By Xah Lee. Date: .

List Large Files

function xah-list-large-files {

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

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

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

}

PowerShell, List Dirs and Files

List Dirs

List Files

Create, Copy, Delete, Dir

Path Tutorial