Echo off
setLocal  

set destfolder=%PUBLIC%\Documents\Soundtoys\Soundtoys 5

ver | find /I "Version 5" > nul
if %ERRORLEVEL% == 0 set destfolder=%ALLUSERSPROFILE%\Documents\Soundtoys\Soundtoys 5

Echo Copying to %destfolder%

rem xcopy used because robocopy only exists on win7/vista

set oldpathx86="%CommonProgramFiles(x86)%\SoundToys"

if /i exist %oldpathx86% (
echo copying presets from %oldpathx86%
pushd %oldpathx86%
FOR /D  %%G in ( "*" ) DO if exist "%destfolder%\%%G" xcopy  "%%G\*" "%destfolder%\%%G\V4Archive\" /D /S /Y /I /Q
popd
)

set oldpathx64="%CommonProgramFiles%\SoundToys"
if /i exist %oldpathx64% (
echo copying presets from %oldpathx64%
pushd %CommonProgramFiles%\SoundToys
FOR /D  %%G in ( "*" ) DO if exist "%destfolder%\%%G" xcopy  "%%G\*" "%destfolder%\%%G\V4Archive\" /D /S /Y /I /Q
popd
)

echo done