Forked from anonymous/gist:93bc103de69a81c6d384b3be41c4afea
Created
November 21, 2016 16:10
-
-
Save Jaykul/11a91a35e9d504077b4112056573239c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
$Source = "c:\users\USER1\desktop\test\folder1", | |
$Destination = "c:\users\USER1\desktop\test\folder2" | |
) | |
$Sources = Get-ChildItem $Source -recurse -depth 4 | Where-Object {$_.name -like "*``, *`` *``(*2016)"} | Select-Object -ExpandProperty FullName | |
Push-Location $Source | |
foreach($SourcePath in $Sources) { | |
$DestPath = Join-Path $Destination (Resolve-Path $SourcePath -Relative) | |
robocopy $SourcePath $DestPath /xo /e | |
} | |
Pop-Location |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment