I have this script:
$destination = "\\myserver\beta\c#apps\MyFolder\";
#$source = "`'$bamboo.build.working.directory`'";
$source = $env:bamboo_Publish_Location;
write-host "Running: Copy-Item -Recurse -Verbose -Path `"$source`" -Destination `"$destination`""
Copy-Item -Recurse -Verbose -Path "$source" -Destination "$destination"
#$cmd = "& Copy-Item -Verbose -Path "$source" -Destination "$destination""
#write-host "Running: $cmd"
#Invoke-Expression $cmd
#copy-item -Recurse -Path $source -destination $destination
#write-host "Running: copy-item $source $destination -Recurse"
#copy-item `"$source`" `"$destination`" -Recurse
That's throwing this error:
Copy-Item : The network name cannot be found. At C:\Program Files\Atlassian\Application Data\bamboo-home\temp\3047425-3244033-3932203-ScriptBuildTask-7378141679293696144.ps1:7 char:1 + Copy-Item -Recurse -Verbose -Path "$source" -Destination "$destinatio ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (\myserver...MyFolder:String) [Copy-Item], IOException + FullyQualifiedErrorId : CreateDirectoryIOError,Microsoft.PowerShell.Commands.CopyItemCommand
And I have no idea why or how to make this work...
If it helps, the write-host spits out:
Running: Copy-Item -Recurse -Verbose -Path "C:/Program Files/Atlassian/Application Data/bamboo-home/xml-data/build-dir/CI-BD-JOB1/Publish/" -Destination "\myserver\beta\c#apps\MyFolder\"
How can I fix this?
gci \\myserver\beta
work? – vonPryz$destination
? in the code sample the UNC has two slashes, but theWrite-Host
output provided only has one e.g."\myserve
– HAL9256Write-Host
does output the path beginning with \\. – Lance U. Matthews