0

I'm trying to copy files using xcopy in octopus deploy. But seems xcopy is not working. Here is the command I'm using in PostDeploy.ps1

xcopy Content C:\websitecode /e /y /exclude:test.txt

Reason for using xcopy is I can exclude multiple files.

Can someone please help me how to use xcopy in octopus deploy...

Thank you.

mahesh
  • 468
  • 2
  • 8
  • 25
  • What, exactly, does `xcopy is not working` mean? No files copied? Wrong files copied? Right files copied into wrong directory? Something else unexpected behavior? – vonPryz Dec 22 '15 at 06:27
  • Hi VonPryz, Thanks for your reply. In my case, xcopy is not copying the files and I don't see any error. – mahesh Dec 22 '15 at 14:10
  • What is in the text.txt file? – tobre Jan 07 '16 at 10:23
  • You can use Powershells copy-item to exclude multiple items by piping get-childitem into copy-item as pointed out in the answer to [this question](http://stackoverflow.com/questions/731752/exclude-list-in-powershell-copy-item-does-not-appear-to-be-working). Therefore you don't have to use xcopy to achieve what you want. – tobre Jan 07 '16 at 13:13
  • @tobre Yes. that will work. Thank you tobre. – mahesh Apr 29 '16 at 20:56

2 Answers2

0

Could you see that your postdeploy.ps1 execution has started in your octopus deployment task log? If you could see try my favorite xcopy script which I am already using it.

$FullPath = "C:\MyFolder"

if ($OctopusEnvironmentName -ceq 'Development')

{
  Write-Host "Console app will be execute"

  & "xcopy" $FullPath/myfolder/*.dll "c:\targetfolder" your parameters | Write-Host

  Write-Host "Console app execution has finied"

}
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Ozgur Kaya
  • 253
  • 2
  • 7
0

It's a known issue that Octopus silently eats xcopy, and the Octopus folks don't seem too concerned about it, providing tons of workarounds like "just use copy-item". That mostly works for me, but I wish I understood why xcopy doesn't work because it might be the case that other things fail silently as well.

sblom
  • 26,911
  • 4
  • 71
  • 95