Quote:

you can replace the whole script with single shell line to robocopy.




Nearly. Renaming the files is a little problematical and you'd need to rely on the ROBOCOPY log rather than the bespoke logging routine.

This appears to be a routine task intended to be carried out by end users rather than support staff, so wrapping enough code around ROBOCOPY to make the process end-user friendly enough is probably going to make the script just as complex. I guess you could pop up a window which says "some sort of error occurred please review the ROBOCOPY log", but where is the fun in that?