Skip to content

Instantly share code, notes, and snippets.

@sawilde
Created October 12, 2012 06:12
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 sawilde/3877585 to your computer and use it in GitHub Desktop.
Save sawilde/3877585 to your computer and use it in GitHub Desktop.
Take a list of files and sort them by name regardless of folder structure
$sorted = [IO.Directory]::GetFiles($path, "*.*", [System.IO.SearchOption]::AllDirectories) |
Select-Object @{Name="FullName"; Expression={$_}}, @{Name="FileName"; Expression={[IO.Path]::GetFileName($_)}} |
Sort-Object FileName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment