0

I am writing psake task for copying a folder to another folder as below.

task -name CopyComponentToBundle -description "Copy the component to bundle" -action {

    Write "Component source is $ComponentPath"
    Write "Component Destination is $ComponentBundlePath"
    exec {      

        Robocopy $ComponentPath $ComponentBundlePath  /MIR /R:0 /W:0
    }   
}

though folders are successfully copied still i am getting error as below.

At C:\Program Files\WindowsPowerShell\Modules\psake\psake.psm1:156 char:17 + throw ("Exec: " + $errorMe ssage) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Exec: Error executing command Roboc opy $ComponentPath $ComponentBundlePath /MIR /R:0 /W:0 .

Is there a way to ignore the errors? All the errors were "Access is denied".

Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230

1 Answers1

0

you could try adding this right before the robocopy command

$ErrorActionPreference = 'SilentlyContinue'
Noah Sparks
  • 1,710
  • 13
  • 14