I need some help modifying a PowerShell script that gives the sizes of folders and outputs the information to a txt file. My output file currently has headers for each row of data that is appended to the file and I want to make it look more like a list with the headers only appearing once at the top. Here is the code:
$Folder = "D:\Media\Movies\G"; gci -force $Folder -recurse | Measure-Object Length -Sum | Select @{Name="Folder";Expression={$Folder}},@{Name="Size";Expression={$_.Sum}} | Out-File -Append -FilePath .\Size.txt