Author Posts

February 5, 2016 at 7:48 am

I want to build a .txt file that has every file in a directory full path on each line.

ls | select name | Out-File test.txt

This is the contents test.txt


What I am looking for is the full path, and I don't want the column header (Name).

Thanks in advance Fellas!

February 5, 2016 at 8:13 am

Does it have to be a txt file. Can it be a csv file?

February 5, 2016 at 8:24 am

No it doesn't have to a txt file. Now that I think of it, a csv would fix my issue! I don't think it will give me the full path of the file though.

February 5, 2016 at 8:32 am

ls | select -ExpandProperty FullName | Out-File test.txt
ls | select -Property FullName | Export-Csv test.csv

February 5, 2016 at 8:36 am

You will need to use Fullname instead of name. Try something like this:

(Get-ChildItem c:\ -Recurse).FullName | export-CSV c:\test.csv

Also this one:

Get-ChildItem c:\ -Recurse | out-file C:\Test\file.txt