0
votes

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?

1
Can you access the UNC path? Does gci \\myserver\beta work?vonPryz
Also, can you verify $destination? in the code sample the UNC has two slashes, but the Write-Host output provided only has one e.g. "\myserveHAL9256
@HAL9256 That appears to be a rendering artifact. In the question markdown Write-Host does output the path beginning with \\.Lance U. Matthews
@vonPryz Agck... it was the wrong path.Sarov

1 Answers

0
votes

I was using the wrong path. Thanks to vonPryz for pointing out to check via gci.