I have the below code which compares the two folders and outputs the files different with respect to each folder, is there a way to get this to output the full file/folder path for files in subfolders?
Cheers
# Create varaibles to store folder paths - pass to Strings...
param([string]$argFolderA,[string]$argFolderB)
# Set variables for folder
$FolderA = Get-ChildItem -Recurse -path $argFolderA
$FolderB = Get-ChildItem -Recurse -path $argFolderB
# Compare the contents and output the files different within each folder.
Compare-Object -ReferenceObject $FolderA -DifferenceObject $FolderB >> C:\CmpOut.txt
Use the Passthru flag of the Comapre-Object like so:
Compare-Object -ReferenceObject $FolderA -DifferenceObject $FolderB -Passthru | % {$_.FullName} >> C:\CmpOut.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With