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
|
@echo off
setlocal EnableDelayedExpansion
Rem ---- définition des variables---
set currentpath=%~dp0
set logdir=%currentpath%log\%date:~6,4%%date:~3,2%%date:~0,2%
set logfile=%logdir%\scan_gbr_%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 /a LotNumNext=%LotNum%+1
set NN=0
echo lot num = %LotNum%
echo lot suivant = %LotNumNext%
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 repWork=%currentpath%WORK_GBR\
set repScan=%currentpath%SCAN_GBR\
set EXT=7z
set zipfile=BNPPLS_GBR_2_%horodatage%_0000%LotNum%.%EXT%
Rem echo %horodatage%
Rem echo %zipfile%
Rem echo %hour%
Rem echo %min%
Rem echo total %hour%%min%
Rem echo %dt%
Rem ---------------------
Rem ----Debut programme -------
REM if not exist %repScan%*.eml GOTO :LOGS
if not exist %repScan%*.eml GOTO :LOGS else echo toto
REM else if (not exist %logdir%) mkdir %logdir% else goto :START
:START
del /Q %repWork%\* >> %logfile%
cd SCAN_GBR >> %logfile%
Move *.* %repWork% >> %logfile%
cd %RepWork% >> %logfile%
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\7-Zip 4.23\7za.exe" a %repWork%%zipfile% %repWork%\* >> %logfile%
REM ------ Suppression fichiers après compression -----
REM for /f "delims=" %%f in ('dir /b') do if not %%~xf == .%EXT% del %%f >> %logfile%
Rem --- incrémentation du numéro de lot -----
echo %LotNumNext% >%currentpath%\conf\lot.conf
Rem ----- Envoi CFT -----------
Rem D:\APPS\CFTG\scripts\cftxsend.bat -D "%part%" -I "%idf%" -F "%chemin%+%fichier%" -P "%env%_%fichier%" –O “RUSER=CANON01M,SUSER=10000000,SAPPL=0x515E7A98”
Rem ----- fin envoi CFT -------
Rem --- fonction de renommage des fichiers -------
REM GOTO: EOF
:INCREM
rename %1 "BNPPLS_GBR_2_%horodatage%_0000%LotNum%_0000000%NN%"
set /A NN=NN+1
Rem ----- fin Fonction Renommage ----
:LOGS
echo Pas de fichier à traiter: dossier Scan vide ! >> %logfile% |
Partager