Skip to content

Instantly share code, notes, and snippets.

@iOnline247
Created March 25, 2016 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iOnline247/0b9ef3037f509dfffb98 to your computer and use it in GitHub Desktop.
Save iOnline247/0b9ef3037f509dfffb98 to your computer and use it in GitHub Desktop.
Generates a report on files within a directory.
# https://www.petri.com/powershell-problem-solver-finding-long-file-names
$folderPath = "\\servername\c$\folderPath"
$csvPath = "C:\fileLengthCheck.csv"
dir -LiteralPath $folderPath -File -Recurse -Force |
Select Directory,Name,@{Name="NameLength";Expression={$_.name.length}} |
Where {$_.NameLength -ge 45} |
Export-Csv -LiteralPath $csvPath -Force -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment