I was being troubled a lot by Robocopy (or maybe anti-virus or maybe Network Hardware). I copy files from the Dynamic View of Clearcase to the local machine for a fresh build. The copy would frequently fail due to:

2012/12/06 15:35:07 ERROR 64 (0x00000040)...

The specified network name is no longer available.

The server and all network hardware resides in another geographical location, so there is no way to ascertain the hardware issues. The anti-virus can never be disabled as per some policy. The Snapshot View cannot be used as per another weird policy or prejudice.

I am left with just one option: to make Robocopy resilient. The following is what I have come up with, which is a wrapper for Robocopy. Please review this.

Summary:

Call Robocopy with parameters

Give it some time and certain number of tries for proper execution

First try is allowed 10 minutes. The subsequent tries will have an increment of 5 minutes. Maximum 5 tries and 30 minutes are allowed.

Catch all Robocopy error codes(0, 1 and 2 are success codes) and re-try.