|Situation: Reports are done in the field, and when the user returns back to the office, the batch file uploads the completed reports to the pdf storage server.|
The issue I have is sometimes the user will incorrectly type the file name.
(Incident numbers / file name are 5 digit numbers)
This has the result of overwriting the existing file on the server if they typed it incorrectly and that numbers has already been used.
I need some help coming up with a way to check C:\Reports\ & \\Mcj_pdc\reports\TIBRS\ before the robocopy.exe line to see if the file already exists on the server, and renaming one of the files to add "_old" so one file will not be deleted off the server if this happens again.
Here is my current code from that section of the batch file.
ECHO Checking connection status, please wait...
PING -n 5 Mcj_pdc|find "Reply from " >NUL
IF NOT ERRORLEVEL 1 goto :BEGINUPLOAD
IF ERRORLEVEL 1 goto :TRYAGAIN
echo Uploading Reports to Server
::UPLOAD ALL REPORT FILES TO PDF SERVER
Robocopy.exe C:\Reports\ \\Mcj_pdc\reports\TIBRS\*.pdf /MOV /NJH /NJS /NC /Z