@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 ichtyometer

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

:ichtyometer

if not exist "NEW\ichtyometer" goto report

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

:report

if not exist "NEW\report" goto end

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

:end

if exist "NEW" rmdir /Q NEW