I would like to output a line to my .txt file/log file that basically grabs the path of $source then says "is compared too" the path of $compare. But when I do this with Out-File they overwrite each other. For instance, if I was to do $source | Out-File $log with only the path before the recurse the next Out-File over writes it. So by the end of my script when I look at my log all that is there is the Compare-Object | Out-File $logI use below.
#prompts user for input through cmd for path of log file
$log = Read-Host -Prompt 'Input path of log, if log does not, create one. Include file name and extension'
#prompts user for input through cmd, saves path, then recursively searches
$source = Read-Host -Prompt 'Input source path'
$source = gci $source -recurse
#prompts user for input through cmd, saves path, then recursively searches
$compare = Read-Host -Prompt 'Input the path of directory to compare'
$compare = gci $compare -recurse
#compares the $source to the $compare and outputs to log file
Compare-Object -ReferenceObject $source -DifferenceObject $compare -PassThru | Out-File $log -width 120