@@ -197,34 +197,36 @@ jobs:
197197
198198 $paths = @(
199199 "OptProf/$(BuildConfiguration)/Data",
200- ' $(Build.StagingDirectory)/MicroBuild/Output' ,
200+ " $(Build.StagingDirectory)/MicroBuild/Output" ,
201201 "log/$(BuildConfiguration)",
202202 "VSSetup/$(BuildConfiguration)",
203203 "packages/$(BuildConfiguration)",
204- ' xsd'
204+ " xsd"
205205 )
206206
207- foreach ($relativePath in $paths) {
208- $from = Join-Path $sourceRoot $relativePath
209- if (-not (Test-Path $from)) {
210- continue
207+ foreach ($path in $paths) {
208+ $from = [System.IO.Path]::Join($sourceRoot, $path)
209+
210+ $destinationSubPath = if ($path -eq "$(Build.StagingDirectory)/MicroBuild/Output") {
211+ "MicroBuild/Output"
212+ } else {
213+ $path
211214 }
212215
213- $to = Join-Path $targetRoot $relativePath
216+ $to = Join-Path $targetRoot $destinationSubPath
217+
218+ Write-Host "Moving '$from' -> '$to'"
219+
214220 $parent = Split-Path $to -Parent
215221 if (-not (Test-Path $parent)) {
216222 New-Item -Path $parent -ItemType Directory -Force | Out-Null
217223 }
218224
219- $robocopyResult = & robocopy $from $to /E /MOVE /NFL /NDL /NJH /NJS /NP
225+ $robocopyResult = & robocopy $from $to /E /MOVE /NFL /NDL /NJH /NJS /NP /MT:8
220226 $exitCode = $LASTEXITCODE
221227 if ($exitCode -ge 8) {
222228 $robocopyResult | Out-String | Write-Host
223- throw "Robocopy failed with exit code $exitCode while moving '$relativePath'."
224- }
225-
226- if (Test-Path $from) {
227- Remove-Item $from -Recurse -Force
229+ throw "Robocopy failed with exit code $exitCode while moving '$path' to '$destinationSubPath'."
228230 }
229231 }
230232
0 commit comments