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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
@echo off
powershell -Command "get-childItem D:\CFT\Tempus\Upload\BPM_Prod\SCAN_FRA\*.eml | rename-item -newname { $_.name -replace '!','' }"
setlocal EnableDelayedExpansion
Rem ---- définition des variables---
set currentpath=%~dp0
set logdir=%currentpath%log\%date:~6,4%%date:~3,2%%date:~0,2%
REM set logfile=%logdir%\scan_fra_%date:~6,4%%date:~3,2%%date:~0,2%_%time:~0,2%h%time:~3,2%%time:~6,2%.log
set /p LotNum=<%currentpath%\conf\lot.conf
set LotNum=!LotNum: =!
set logfile=%logdir%\ScanFra_%date:~6,4%%date:~3,2%%date:~0,2%_LOT_%LotNum%.log
set /a LotNumNext=%LotNum%+1
set NN=0
set Length=0
echo lot num = %LotNum%
echo lot suivant = %LotNumNext%
echo %logfile%
set hour=%time:~0,2%
set min=%time:~3,2%
set horodatage=%date:~6,4%%date:~3,2%%date:~0,2%T%hour%%min%
set horodatage=!horodatage: =!
set repWork=D:\CFT\Tempus\Upload\BPM_Prod\WORK_FRA\
set repScan=D:\CFT\Tempus\Upload\BPM_Prod\SCAN_FRA\
set repArch=D:\CFT\Tempus\Upload\BPM_Prod\ARCHIVE\
set repRejet=D:\CFT\Tempus\Upload\BPM_Prod\REJET\
Rem echo %horodatage%
Rem echo %zipfile%
Rem echo %hour%
Rem echo %min%
Rem echo total %hour%%min%
Rem echo %dt%
Rem ------------------------
REM ---- Fonction pour compléter le numéro de lot avec des 0 devant pour respecter la taille de String 8 ----
set #=%LotNum%
:loop
if defined # (
set #=%#:~1%
set /A Length += 1
goto loop
)
if %Length% LSS 8 goto less_8
:less_8
set /a t=(8-%Length%)
echo T =%t%
set LotNumZeros=0
for /l %%i in (2,1,%t%) do call set "LotNumZeros=%%LotNumZeros%%%LotNumZeros%"
set FinalLotNum=%LotNumZeros%%LotNum%
REM -----------fin bloc de fonction -------
REM ---- Définiton du nom du zip en sortie -----------
set EXT=7z
set zipfile=BNPPLS_FRA_2_%horodatage%_%FinalLotNum%.%EXT%
set zipfile=!zipfile: =!
REM ------- fin définition du nom de zip -----
Rem ----Debut programme -------
if not exist %logdir% (mkdir %logdir%)
if not exist %repScan%*.eml GOTO :LOGS
del /Q %repWork%\* >> %logfile%
cd %repScan% >> %logfile%
Move *.eml* %repWork% >> %logfile%
Move *.* %repRejet% >> %logfile%
cd %RepWork% >> %logfile%
REM ---
FOR %%I IN (*.*) DO call :INCREM "%%I" >> %logfile%
Rem "C:\Program Files\WinZip\Winzip8.1_FR\WINZIP32.exe" -a %repWork%%zipfile% %repWork%\*.* >> %logfile%
"C:\Program Files\7-Zip\7z.exe" a %repWork%%zipfile% %repWork%\* >> %logfile%
.... |
Partager