Was just playing with exporting directory listings to CSV and noticed a little strangeness. I hope someone can enlighten me why this happens?
Two commands which seem to work the same,
[pre]Get-ChildItem | Select-Object fullname,length | ConvertTo-Csv |out-file -FilePath dir-list.csv[/pre]
[pre]Get-ChildItem | Select-Object fullname,length | Export-Csv -Path dir-list2.csv[/pre]
The resulting files look the same in Notepad++ and when 'cat’ed. But when the file sizes are checked the first command always creates a file about twice the size of the second command. I have opened both files in a hex editor and the larger file shows NULL (hex code 00) characters separating every character which accounts for the size difference. Why is this happening?