I have this code to list how many files I have in each subdirectory
dir -recurse | ?{ $_.PSIsContainer } | %{ Write-Host $_.FullName (dir $_.FullName | Measure-Object).Count }
and it works awesome. But now I like to save it as a file the result and now I have problem.
I has tried with three different ways but the only thing it does is create the file but there is nothing in it.
I have try with
| Export-Csv -Path .\data1.csv -NoTypeInformation
| Out-File -FilePath .\data1.txt
and even
>> Data.txt