Created
July 6, 2026 12:54
-
-
Save puiutucutu/ace2ec0b60906fbe7d00b6a1f5fded55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [System.IO.DirectoryInfo] supports UNC paths natively (e.g., \\server\share\folder). | |
| $path = "\\server\share\folder" | |
| $topN = 20 | |
| [System.IO.DirectoryInfo]::new($path).EnumerateFiles("*", [System.IO.SearchOption]::AllDirectories) | | |
| Sort-Object Length -Descending | | |
| Select-Object -First $topN | | |
| Select-Object FullName, @{Name="SizeMB"; Expression={[Math]::Round($_.Length / 1MB, 2)}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment