Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 9th, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Comparing folders and content with PowerShell
  2. $Folder1 = Get-childitem "C:Folder1"
  3. $Folder2 = Get-childitem  "C:Folder2"
  4.        
  5. Compare-Object $Folder1 $Folder2 -Property Name, Length  | Where-Object {$_.SideIndicator -eq "<="} | ForEach-Object {
  6.         Copy-Item "C:Folder1$($_.name)" -Destination "C:Folder3" -Force
  7.         }