@echo off
echo %date% %time:~0,5%
set n_ver=%date:~0,2%%date:~3,2%-%time:~0,2%
rem n_ver=1
set FILE1TOZIP=.\Logs
set FILE2TOZIP=.\Experts
set FILE3TOZIP=.\Indicators
set FILE4TOZIP=.\Include
set FILE5TOZIP=.\Scripts

:boucle
set ZIPEDFILE="C:\Users\Administrateur\AppData\Roaming\MetaQuotes\Terminal\E88DA660F9A20E5DD9C622B8430BA4F1\MQL4\Versions mq4-mqh (%n_ver%).zip"
IF EXIST %ZIPEDFILE% (
rem chcp 1252
echo.
echo *** Le répertoire de COMPRESSION existe d‚j… !! ***
rem chcp 850
echo.
pause
exit )
IF EXIST %ZIPEDFILE% (
set /a n_ver=%n_ver% + 1
goto boucle )

set COPYDIR=C:\Users\Administrateur\AppData\Roaming\MetaQuotes\Terminal\E88DA660F9A20E5DD9C622B8430BA4F1\MQL4\temp738
IF NOT EXIST %COPYDIR% ( mkdir %COPYDIR%
mkdir %COPYDIR%\%FILE1TOZIP%
mkdir %COPYDIR%\%FILE2TOZIP%
mkdir %COPYDIR%\%FILE3TOZIP%
mkdir %COPYDIR%\%FILE4TOZIP%
mkdir %COPYDIR%\%FILE5TOZIP% )
rem fc %FILE2TOZIP%\*.mq4 %COPYDIR%\%FILE2TOZIP%\*.*>%COPYDIR%\tst.txt
rem fc %FILE3TOZIP%\*.mq4 %COPYDIR%\%FILE3TOZIP%\*.*>>%COPYDIR%\tst.txt
rem fc %FILE4TOZIP%\*.* %COPYDIR%\%FILE4TOZIP%\*.*>>%COPYDIR%\tst.txt
rem fc %FILE5TOZIP%\*.mq4 %COPYDIR%\%FILE5TOZIP%\*.*>>%COPYDIR%\tst.txt
fc %FILE2TOZIP%\*.txt %COPYDIR%\%FILE2TOZIP%\*.*>%COPYDIR%\comp_Experts.txt
fc %FILE3TOZIP%\*.txt %COPYDIR%\%FILE3TOZIP%\*.*>%COPYDIR%\comp_Indicators.txt
fc %FILE4TOZIP%\*.txt %COPYDIR%\%FILE4TOZIP%\*.*>%COPYDIR%\comp_Include.txt
fc %FILE5TOZIP%\*.txt %COPYDIR%\%FILE5TOZIP%\*.*>%COPYDIR%\comp_Scripts.txt
del %FILE2TOZIP%\*EA.txt
del %FILE3TOZIP%\*Ind.txt
del %FILE4TOZIP%\*.txt
del %FILE5TOZIP%\*.txt
call :size_file %COPYDIR%\tst.txt
echo.
echo file size is %size% bytes
echo.
pause
del %COPYDIR%\tst.txt
rem if %size% lss 28210 goto end
del %COPYDIR%\%FILE1TOZIP%\*.log
copy %FILE1TOZIP%\*.* %COPYDIR%\%FILE1TOZIP%\*.*
copy %FILE2TOZIP%\*.mq4 %COPYDIR%\%FILE2TOZIP%\*.*
copy %FILE3TOZIP%\*.mq4 %COPYDIR%\%FILE3TOZIP%\*.*
copy %FILE4TOZIP%\*.* %COPYDIR%\%FILE4TOZIP%\*.*
copy %FILE5TOZIP%\*.mq4 %COPYDIR%\%FILE5TOZIP%\*.*
set tsize=5000
:exit

CScript _zipIt.vbs %COPYDIR% %ZIPEDFILE% %tsize%
rem pause

call :size_file %ZIPEDFILE%
echo file is %size%
if %size% gtr 1000 goto end
set /a tsize=%tsize% + 2000
goto exit

:end
exit

:size_file
set size=%~z1
