Sunday, May 9, 2010

Update wampserver apache version

Here is a batch that would do the work. It is based on a thread in the forums. Provided as is without any warranty.
@echo off
set dest_root=E:\usr\wamp\bin\apache
set source_root=%~dp0

set apache_zip=
for /f %%f in ('dir /b/ogn %source_root%httpd-*') do set apache_zip=%%f
if "%apache_zip%"=="" goto :eof
set unzip_dir=%apache_zip%
set unzip_dir=%unzip_dir:~0,-4%
if "%unzip_dir%"=="" goto :eof
if exist "%unzip_dir%" rd /s/q "%unzip_dir%"
e:\usr\7-Zip\7z x -o%unzip_dir% %apache_zip%

echo %unzip_dir%

set ver=%unzip_dir:~6,-14%
set dest_dir=%dest_root%\Apache%ver%
echo %dest_dir%

if exist "%dest_dir%" rd /s/q "%dest_dir%"

set previous_ver=
for /f %%f in ('dir /b/ogn/ad %dest_root%\Apache*') do if not "%%f"=="%ver%" set previous_ver=%%f
set previous_ver=%previous_ver:~6%
set previous_dir=%dest_root%\Apache%previous_ver%
echo %previous_dir%

mkdir %dest_dir%
robocopy /NP /MIR /NFL "%unzip_dir%\Apache2" "%dest_dir%" /XD lib /XD include /XD manual
copy %previous_dir%\wampserver.conf %dest_dir% >nul
copy %previous_dir%\conf\httpd.conf %dest_dir%\conf >nul

rd /s/q %unzip_dir%

No comments: