CopyDirectory
indeed has a bug that only issues a warning when the source directory doesn't exist. It also has problems with long paths (>248 chars).
Possible workarounds:
- Use
InvokeCommand
, runningRobocopy.exe
(better thanxcopy
) and checking its resultcode. - If you must use
CopyDirectory
, check yourself that the source directory exists.