1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
1 @echo off
2 for /f "delims=" %%i in ('type liste.txt') do (
3 echo %%i
4 set tmpfile=tmp%%i.txt
5 set filepath=C:\dev\%%i\logs
6
7 ::Listage du répertoire
8 :getlist
9 dir %filepath% /O:-D > %tmpfile%
10
11 ::Vérification de la présence du fichier
12 find "%today%" "%tmpfile%" > nul
13 if %ERRORLEVEL% neq 0 (
14 echo Pas de fichier trouve
15 del "%tmpfile%") ELSE goto :getfile
16
17 :getfile
18 ::Récupération du nom du fichier - local
19 for /f "tokens=5 delims= " %%j in ('find "%today%" "%tmpfile%"') do set filename=%%j
20
21 ::Vérification de la non-présence du terme ANOMALIE
22 find "ANOMALIE" "%filepath%\%filename%" > nul
23 if %ERRORLEVEL% neq 1 (
24 echo Anomalie détectee
25 del "%tmpfile%") ELSE goto :chkend
26
27 :chkend
28 ::Vérification que le fichier s'est bien terminé
29 find "Fin de traitement " "%filepath%\%filename%" > nul
30 if %ERRORLEVEL% neq 0 (
31 echo Fichier non termine
32 del "%tmpfile%") ELSE echo OKY DOKY
33
34 ::Suppression du fichier temp
35 del "%tmpfile%" ) |