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"
6 Comments
Post a comment
Perfect and well-written code. Thank you!
Still useful in 2017!! Better organized code than what I found on the Net.
If you do *not* want the empty folder names… and only a file name list… remodify this line to the following:
$list = Get-ChildItem $path -Recurse | where {!$_.PSIsContainer}
Hi,
Great work… I have taken the liberty of creating a public gist for this. Do let me know if that is a concern.
https://gist.github.com/vermaakarsh/1e169cd5a148a7618fd8f8465ac79a89
I have noticed you don’t monetize your page, don’t waste
your traffic, you can earn additional cash every month.
You can use the best adsense alternative for any type of website
(they approve all websites), for more info simply search in gooogle:
boorfe’s tips monetize your website
I don’t even know how I stopped up here, however I thought this publish was
once great. I don’t realize who you might be but definitely you’re going
to a famous blogger for those who are not
already. Cheers!