Hi,
We currently have a script that Purges a folder structure apart from 3 files and a folder.
$Result = Robocopy "source" "target" *.* /NP /V /E /R:1 /W:1 /PURGE /XF File1 File2 File3 /XD Folder
this works as expected, However when then checking if the robocopy was successful
if ($result -gt 7){"fail"}
The result is always a failure. I believe it has something to do with the exclusion of files and folders from a purge but I am unsure.
Without having the exlusion the if statement works for a purge and without (useful when running jobs and so cannot see the lastexitcode)
Does anyone know why this behaviour occurs and if there is anyway of getting round it
Thanks
tom