Follow my solution Windows side, to automatcly check if my MFT post processing script done the right work.
As for Unix system in Windows each received file "land" in a work directory.
The following script analyze, each morning, the state of this directory and its subfolders:
At the beginning register variable, it is useful to use script in other environment. In the EXCEPTIONS file I store name of folder or files (absolute path) I know it is possible the script find, but their existence is not a problem for me.SET WORKDIR=C:\Batch\bin\MyDir
SET TEMPDIR=C:\Batch\temp
SET LOG=ControllaDir.log
SET EXCEPTIONS =C:\batch\bin\ControllaDirEccezioni.ini
:CHECKDIR
dir %INPUTDIR% /b /s /a:-d >%TEMPDIR%\%LOG%
:CLEANEXCEPTIONS
for /F %%I in (%EXCEPTIONS %) do (
findstr /B /V /C:%%I %TEMPDIR%\%LOG% >%TEMPDIR\%LOG%A
move /Y %TEMPDIR%\%LOG%A %TEMPDIR%\%LOG%)
:DATEHEADER
echo . >>D:\%LOG%
echo ##################%date%#############>>D:\%LOG%
:NOFILE
for %%R in (%TEMPDIR%\%LOG%) do if %%~zR equ 0 (
echo Today no problem found >>D:\%LOG%
)
type %TEMPDIR%\%LOG% >>D:\%LOG%
:SENDEMAIL
blat D:\%LOG% -to casaprocida@mioserver.it
:FINE
The first step check for each file in WORKDIR and its subfolder. The parameter /b doesn't explain file attribute; /s if for recursive dir; /a:-d show file name and its absolutely path.
The step CLEANEXCEPTIONS is useful to avoid false positive results. I know some files is not a problem if exist. Inserted them, or the folder name where i can find it, the step clean the log file from them. The EXCEPTIONS file have to report for each line the absolute path of the file.
I prefer have a logfile each day, even if it doesn't find occorrency. This is my check to know the script run correctly (a check on the check). To do that I write on the log file a separator including the data running. The step DATAHEADER do that.
The NOFILE step write in the log file that today is a lucky day (good morning starts in the morning).
Last step SENDEMAIL send file via SMTP using the send mail of the good BLAT. But if you want you can use other solution to propagate this file.
Nessun commento:
Posta un commento