Please help, I need the script if the robocopy is going to MIR more than 100 files it should send alert and stop MIR operation. If it is less that 100 then it can perform the MIR operation.

  • 2
    Use /L : List only - don’t copy, timestamp or delete any files. Then parse the output. – DavidPostill May 27 '20 at 19:10
  • Please edit, add that code to the question and make sure you format it as code. – DavidPostill May 30 '20 at 8:56

Thanks,I have created one batch script to send success and failure status mails. But in the below script if the status is 'failed', it is sending both success and failure mails. Eg: for testing purposes removed access for one source file and it's sending both mails instead of failure alone.Please advise if there is any correction on the script

Robocopy source destination /l /mir /w:0 /r:1 /z /log:log path
If %ERRORLEVEL% LSS 8 goto :Finish
Poweshell -ExecutionPolicy Bypass -Command "D:/failure.ps1' Exit /B
Poweshell -ExecutionPolicy Bypass -Command "D:/success.ps1'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.