Skip to content

August 4, 2009


Export List of File Names with PowerShell

Here’s a quick and easy little function to get a list of files (and their paths) using PowerShell.

Function GetFileNames([string]$path, [string]$outputFile) {
  $list = Get-ChildItem $path -Recurse
  $list | Select-Object BaseName, FullName | Export-Csv $outputFile

GetFileNames ".\" "C:\Output.csv"
Read more from PowerShell
1 Comment Post a comment
  1. Afif Khaja
    Jul 10 2017

    Perfect and well-written code. Thank you!

Share your thoughts, post a comment.


Note: HTML is allowed. Your email address will never be published.

Subscribe to comments