Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
gci $Source -Recurse -Filter ".git" -Force -Directory | %{
$dir = Join-Path (Join-Path $target $_.Parent.Name) ".git"
robocopy $_.FullName $dir /MIR | Out-Null
if ($LASTEXITCODE -gt 7) {
Write-Error "RoboCopy exited with code $($LASTEXITCODE). Something bad happended when taking backup of $($_.Parent.FullName)!"
else {
Write-Output "Mirrored content of $($_.FullName) to $dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.