Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-FolderSizeRC($Path) {
- if ( robocopy $Path c:\dummy /e /r:0 /w:0 /b /BYTES /nfl /ndl /np /njh /l | ? { $_ -match 'Bytes :\s*(?<size>\S+)' } ) { return [int64]$Matches.size }
- }
- function Get-FolderSizePS($Path) {
- return ( ls -Recurse -Path $Path -Force | measure -Property length -Sum ) | select -ExpandProperty Sum
- }
- function test($Path) {
- Write-Host -Object "Testing $Path" -ForegroundColor Cyan
- "Read folder size (RC): $([math]::Round((Measure-Command { $size = Get-FolderSizeRC -Path $Path } | select -ExpandProperty TotalSeconds),1))s / $size ($([math]::Round(($size/1Mb)))Mb)"
- "Read folder size (PS): $([math]::Round((Measure-Command { $size = Get-FolderSizePS -Path $Path } | select -ExpandProperty TotalSeconds),1))s / $size ($([math]::Round(($size/1Mb)))Mb)"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement