What I am attempting to do is have an end CSV file like this:
path , get-childItem
path , get-childItem
path , get-childItem
etc.
I am very new to powershell so as of right now the issue I am having isn't with errors but rather actually knowing what to do
Here is my code thus far:
$data = gc "c:\Documents and Settings\user\Desktop\paths.txt"
ForEach($line in $data) {
$subName = Get-ChildItem "$line"
write-host $line","$subName
#Export-Csv -Path "C:\Documents and Settings\reidli\Desktop\mytest.csv" -Force "true" -InputObject $output
So I am reading a list of paths from paths.txt where each line is a different path $subName is the list of Children i want and is correct and when I write-host the output is in fact: path,children commentented out is where I attempted to export csv, but this wont work as it would over-write the existing csv for each path
Can someone please help me take each line in the foreach loop and create a .csv file with each path and children?