Wednesday, August 12, 2015

Compare Directories PowerShell

 

This compares to 2 directories and tells you what side they are on.

Warning DO NOT  use this on a large folder structure of like 1 million files/directories.

 

$intialDir =  Read-Host -Prompt 'First path?'

$secondDir =  Read-Host -Prompt 'Second path?'

 

 

$fso = Get-ChildItem -Recurse -path $intialDir

 

$fsoBU = Get-ChildItem -Recurse -path $secondDir

 

Compare-Object -ReferenceObject $fso -DifferenceObject $fsoBU | Out-GridView

 

 

No comments:

Post a Comment