I've made a batch file and using few tricks I've made it work quite well but didn't realized that script will generate quite long command and many variables to work with, which generates error.
The error which sometime appears!
not enough storage is available to process this command.@echo off
set oldfiledir=E:\patch\12
set newfiledir=E:\patch\15
set patcheddir=%~dp0
IF %patcheddir:~-1%==\ SET patcheddir=%patcheddir:~0,-1%
@pause >nul
for /F %%B in ('dir "%newfiledir%\*" /A:-D /S /B') do for /F %%A in ('dir "%oldfiledir%\*" /A:-D /S /B') do (
IF NOT EXIST "%patcheddir%\patched%%~pA" md "%patcheddir%\patched%%~pA"
IF "%%~nxB" == "%%~nxA" For /F %%D in ('md5sums -u "%%B"') do for /F %%C in ('md5sums -u "%%A"') do (
IF NOT "%%D" == "%%C" bsdiff "%%A" "%%B" "%patcheddir%\patched%%~pnxA.bsdfp" )
)
ECHO Complete! Press any key to exit!
@pause >nul
What the batch is doing.
It takes files from 2 folders, e:\patch\12 with old files and then e:\patch\15 new files.
Then compare the files from first dir by name and extension to the file from second dir to check if file name and extension matches. After that md5sums does same check, but only checks the files that matches by name and extension, so we to be sure we are checking data1.dll with newer data1.dll and not with data2.dll, if the md5 of data1.dll does not match with the md5 of the newer data1.dll then use bsdiff to create the patch and put that patch into a new directory.
Now how i can do that script working?
The echo bellow is from the same script without showing the error, but probably on bigger files it does showing error. I receive the said error only on files that are quite yuge on file size.
E:\patch>(
IF NOT EXIST "E:\patch\patched\patch\12\Dll\" md "E:\patch\patched\patch\12\Dll\"
IF "data1.dll" == "data1.dll" For /F %D in ('md5sums -u "E:\patch\15\Dll\data1.dll"')
do for /F %C in ('md5sums -u "E:\patch\12\Dll\data1.dll"')
do (IF NOT "%D" == "%C"
bsdiff "E:\patch\12\Dll\data1.dll" "E:\patch\15\Dll\data1.dll" "E:\patch\patched\patch\12\Dll\data1.dll.bsdfp" )
)
E:\patch>for /F %C in ('md5sums -u "E:\patch\12\Dll\data1.dll"')
do (IF NOT "6fc61964424ed6353b0b2c07c6863c20" == "%C"
bsdiff "E:\patch\12\Dll\data1.dll" "E:\patch\15\Dll\data1.dlll" "E:\patch\patched\patch\12\Dll\data1.dll.bsdfp" )
E:\patch>(IF NOT "6fc61964424ed6353b0b2c07c6863c20" == "6fc61964424ed6353b0b2c07c6863c20"
bsdiff "E:\patch\12\Dll\data1.dll" "E:\patch\15\Dll\data1.dll" "E:\patch\patched\patch\12\Dll\data1.dll.bsdfp" )
If you want to test with xdelta
replace IF NOT "%%D" == "%%C" bsdiff
with IF NOT "%%D" == "%%C" xdelta3-3.0.8.x86-32 -9 -S djw -e -vfs
and it will work with xdelta the same way as bsdiff too.
bsdiff for win32
http://sites.inka.de/tesla/others.htmlxdelta
https://code.google.com/p/xdelta/md5 for win32
http://www.pc-tools.net/win32/md5sums/I prefer bsdiff because it does not shows additional output and compression is much better on patches.
If anyone can provide a gui which to do that for bsdiff it would be nice, i found a gui for xdelta but is written in net and it doesn't work on x64 bit so tried to write a batch for it instead, any help is appreciated. Thank you in advance!