Skip to content

Instantly share code, notes, and snippets.

@cwg999
Created August 2, 2017 17:22
Show Gist options
  • Save cwg999/325268a67d18317e0eee80100d9eb299 to your computer and use it in GitHub Desktop.
Save cwg999/325268a67d18317e0eee80100d9eb299 to your computer and use it in GitHub Desktop.
Given a parent folder name, output file names greater than a certain size.
Get-ChildItem -Path .\ -Recurse | Where-Object {
$_ -is [System.IO.FileInfo] `
-and (($_.Directory.Name -eq 'Single' `
-and $_.Length -gt (1*1024*1204)) `
-or ($_.Directory.Name -eq 'Multiple' `
-and $_.Length -gt (7*1024*1204)))
} | ForEach-Object {$_.FullName}
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host
Write-Host "Finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment