set n_ver=1
set FILE1TOZIP="C:\Users\Administrateur\Downloads\Telegram Desktop"
set FILE2TOZIP="C:\Users\Administrateur\Downloads\Telegram Desktop\Copy_Trade"
set FILE3TOZIP=".\Files"
set FILE4TOZIP=".\Logs"
set FILE5TOZIP=".\Experts"

:boucle
set ZIPEDFILE="C:\Users\Administrateur\AppData\Roaming\MetaQuotes\Terminal\B3511AE7AE29D20268E67E28E5D8DF10\MQL4\Zip Test (FH4-%n_ver%).zip"
IF EXIST %ZIPEDFILE% (
set /a n_ver=%n_ver% + 1
goto boucle )

set COPYDIR=C:\Users\Administrateur\AppData\Roaming\MetaQuotes\Terminal\B3511AE7AE29D20268E67E28E5D8DF10\MQL4\temp738
mkdir %COPYDIR%
mkdir %COPYDIR%"\Telegram Desktop"
mkdir %COPYDIR%"\Telegram Desktop\Copy_Trade"
mkdir %COPYDIR%\%FILE3TOZIP%
mkdir %COPYDIR%\%FILE4TOZIP%
mkdir %COPYDIR%\%FILE5TOZIP%
copy %FILE1TOZIP%\*.txt %COPYDIR%"\Telegram Desktop"\*.*
copy %FILE1TOZIP%\*.log %COPYDIR%"\Telegram Desktop"\*.*
copy %FILE2TOZIP%\*.* %COPYDIR%"\Telegram Desktop\Copy_Trade"\*.*
copy %FILE3TOZIP%\op*.txt %COPYDIR%\%FILE3TOZIP%\*.*
copy %FILE3TOZIP%\lm*.txt %COPYDIR%\%FILE3TOZIP%\*.*
copy %FILE3TOZIP%\ma*.log %COPYDIR%\%FILE3TOZIP%\*.*

set n_ver=1
:boucle2
set FILE3TOZIP_=%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
IF EXIST %FILE3TOZIP_% (
mkdir %COPYDIR%%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
copy %FILE3TOZIP_%\*.* %COPYDIR%%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
set /a n_ver=%n_ver% + 1
goto boucle2 )

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
del /s /q %COPYDIR%"\Telegram Desktop\Copy_Trade"\*.*
del /s /q %COPYDIR%"\Telegram Desktop"\*.*
set n_ver=1
:boucle3
set FILE3TOZIP_=%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
IF EXIST %FILE3TOZIP_% (
del /s /q %COPYDIR%%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"\*.*
set /a n_ver=%n_ver% + 1
goto boucle3 )
del /s /q %COPYDIR%\%FILE3TOZIP%\*.*
del /s /q %COPYDIR%\%FILE4TOZIP%\*.*
del /s /q %COPYDIR%\%FILE5TOZIP%\*.*
rmdir /s /q %COPYDIR%"\Telegram Desktop\Copy_Trade"
rmdir /s /q %COPYDIR%"\Telegram Desktop"
set n_ver=1
:boucle4
set FILE3TOZIP_=%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
IF EXIST %FILE3TOZIP_% (
rmdir /s /q %COPYDIR%%FILE3TOZIP%"\Telegram_copied (1) copie(%n_ver%)"
set /a n_ver=%n_ver% + 1
goto boucle4 )
rmdir /s /q %COPYDIR%\%FILE3TOZIP%
rmdir /s /q %COPYDIR%\%FILE4TOZIP%
rmdir /s /q %COPYDIR%\%FILE5TOZIP%
rem rmdir %COPYDIR%
exit

:size_file
set size=%~z1
