How to automate creating and sending of the Verimove monthly reports to the USPS

Products Affected:  Verimove
Below is a sample script that runs mureport and then sends the reports to epf using getfilehttps.  You will need to set the variables for Verimove installation, report directory, and the epf userid and password.  You can have windows task scheduler execute this on the first of the month, but it can be run on demand as well.
 
There are notes in the file describing the functions such as:
 
- delete .dat files from reports directory
- run mureport using default reporting dates
- determine naming convention for this month's files
- create folder for this month's files
- run getfilehttps to zip and send this month's reports
 
Feel free to modify this script to suit your needs. 

rem *** This will use the jobstats from INSTALLDIR\stats to create 
rem *** monthly NCOA reports that will be stored in REPORTDIR\qqqqmyy
rem *** folder (where qqqq is ncoa platform id, myy is month/year of report).
rem *** The reports will be zipped and sent to the USPS using getfileHTTPs.exe

rem *** This is scheduled to run on the first of the month, so the mureport
rem *** job doesn't specify a start or end date. This defaults mureport to using 
rem *** the prior month start and end dates if run between the 1st and 15th 
rem *** of the month.  If this script is run on demand after the 15th, then the
rem *** current month start date will be used and the end date will be the
rem *** current date.   Alternately, the report date span could be added as 
rem *** parameters to the mureport call to set a specific report time period. 

rem *** this script uses the first .dat filename in the reports folder to get 
rem *** the report name to upload, so the folder is cleared of .dat files at
rem *** the start. 
rem *** If this is not feasible, change the getfilehttps call to add the 
rem *** specific file name that is desired upload. 

rem *** output console messages are saved into REPORTDIR\MonthlyReport.log
rem *** and also copied to the resulting qqqqmyy folder

rem *** Set these variables:
rem *** INSTALLDIR is verimove installation directory
rem *** REPORTDIR is where reports will be saved
rem *** EPFUSER is the epf upload userid
rem *** EPFPASS is the epf upload password

set INSTALLDIR=D:\pb\verimove
set REPORTDIR=D:\pb\verimove\reports
set EPFUSER=
set EPFPASS=

rem ***
rem *** delete .dat files in REPORTDIR
rem ***
echo delete existing reports
del /Q %REPORTDIR%\*.dat

rem ***
rem *** run mureport using JobStats.dat and output into REPORTDIR
rem ***
echo running mureport
cd %INSTALLDIR%
mureport -j%INSTALLDIR%\stats\JobStats.dat -o%REPORTDIR%>%REPORTDIR%\MonthlyReport.log
set SVERRLVL=%ERRORLEVEL%

rem ***
rem *** if error, issue message 
rem ***
if NOT "%SVERRLVL%"=="0" (
echo Sending MURPEORT error message
echo Monthly reports generation failed.  MUREPORT RC=%SVERRLVL%>>%REPORTDIR%\MonthlyReport.log
goto End
)

rem ***
rem *** get name for zip file based on first .dat file in reports.
rem *** strip off extension, then strip off first char of name
rem *** this will be the zip filename for USPS reports
rem ***
cd %REPORTDIR%
SETLOCAL ENABLEDELAYEDEXPANSION
for /f %%i IN ('dir /b /a-d %REPORTDIR%') do (
  SET FNAME=%%~ni
  IF "%%~xi"==".DAT" (goto GOTFILENAME)
)
:GOTFILENAME
set zipname=%FNAME:~1,7%

rem ***
rem *** delete and create folder for this months reports
rem *** and move in the newly created reports
rem ***
rmdir %zipname% /s /q
mkdir %zipname%
move /Y *.dat %zipname%


rem ***
rem *** use getfileHTTPS to zip reports and send to USPS 
rem ***
echo Create report ZIP file and send to USPS
cd %INSTALLDIR%\Utilities
getfileHTTPS.exe "%EPFUSER%" "%EPFPASS%" CSL -ufp:%REPORTDIR%\%zipname% -ufn:%zipname%>>%REPORTDIR%\MonthlyReport.log
set SVERRLVL=%ERRORLEVEL%

rem ***
rem *** if error sending reports 
rem ***
if NOT "%SVERRLVL%"=="0" (
echo Zip error message
echo Sending Monthly NCOA reports failed for %zipname%.  getfileHTTPs.exe RC=%SVERRLVL%>>%REPORTDIR%\MonthlyReport.log
goto End
)

rem ***
rem *** success 
rem ***
echo Reports successfully built and sent
echo Monthly NCOA reports for %zipname% successfully generated and sent to USPS.>>%REPORTDIR%\MonthlyReport.log
goto End

:End
copy /Y %REPORTDIR%\MonthlyReport.log %REPORTDIR%\%zipname%
UPDATED:  May 9, 2019