@echo off

set t=%time::=%
set BACKUP_DATE=%date:~6,4%%date:~3,2%%date:~0,2%%t:~0,6%

if not exist "NEW\jre" goto tutti

rem deplacement de l'ancienne jre
set /p oldVersion=<jre\version.appup
set /p newVersion=<NEW\jre\version.appup
set backupdir=OLD\jre-%oldVersion: =%-%BACKUP_DATE: =%
echo Update jre version %oldVersion: =% to %newVersion: =% old jre keep in "%backupdir%"
if not exist "OLD" mkdir OLD
move jre "%backupdir%"
move NEW\jre jre

:tutti

if not exist "NEW\tutti" goto i18n

rem deplacement de l'ancien tutti
set /p oldVersion=<tutti\version.appup
set /p newVersion=<NEW\tutti\version.appup
set backupdir=OLD\tutti-%oldVersion: =%-%BACKUP_DATE: =%
echo Update tutti version %oldVersion: =% to %newVersion: =% old tutti keep in "%backupdir%"
if not exist "OLD" mkdir OLD
move tutti "%backupdir%"
move NEW\tutti tutti

:i18n

if not exist "NEW\i18n" goto help

rem deplacement de l'ancien i18n
set /p oldVersion=<i18n\version.appup
set /p newVersion=<NEW\i18n\version.appup
set backupdir=OLD\i18n-%oldVersion: =%-%BACKUP_DATE: =%
echo Update i18n version %oldVersion: =% to %newVersion: =% old i18n keep in "%backupdir%"
if not exist "OLD" mkdir OLD
move i18n "%backupdir%"
move NEW\i18n i18n

:help

if not exist "NEW\help" goto end

rem deplacement de l'ancien help
set /p oldVersion=<help\version.appup
set /p newVersion=<NEW\help\version.appup
set backupdir=OLD\help-%oldVersion: =%-%BACKUP_DATE: =%
echo Update help version %oldVersion: =% to %newVersion: =% old help keep in "%backupdir%"
if not exist "OLD" mkdir OLD
move help "%backupdir%"
move NEW\help help

:end

if exist "NEW" rmdir /Q NEW