Skip to content

Instantly share code, notes, and snippets.

@nestorium
Created October 14, 2019 12:45
Show Gist options
  • Save nestorium/0ca209a232f164db645293c3db749df0 to your computer and use it in GitHub Desktop.
Save nestorium/0ca209a232f164db645293c3db749df0 to your computer and use it in GitHub Desktop.
Powershell script to find files recursively that have longer lines than the parameter set
$rootDirectory = "c:\Temp\"
$maxLengthOfCharacters = 30000
$foundFiles = Get-ChildItem $rootDirectory -File -Recurse | Where-Object {(Get-Content($_.Fullname) | Measure-Object -Maximum Length | Select-Object -ExpandProperty Maximum) -ge $maxLengthOfCharacters}
$foundFiles | ForEach-Object{ Write-Host $_.Name}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment