Thank you for the anwer
And yes you are correct about the date conversion.
I will implant that and will let you know if that solves it
Thank you verry much Aacini
Its solved now
It is comparing in the correct way and if e:\Pandoraflyff\Resclient\file.res is greater then e:\Pandoraflyff\Patcher he only gzips the correct file.
Here is the altered code.
BTW i didnt not set the datetime conversion in the batch file but i did it with the registery.
Code: Select all
@echo off
SETLOCAL EnableDelayedExpansion
SETLOCAL EnableDelayedExpansion
for /f "skip=1 tokens=1-6 delims= " %%a in ('wmic path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') do (
IF NOT "%%~f"=="" (
set /a FormattedDate=10000 * %%f + 100 * %%d + %%a
set FormattedDate=!FormattedDate:~-2,2!-!FormattedDate:~-4,2!-!FormattedDate:~-8,4!
)
)
REM GETTING FILES IN RESCLIENT
FOR /R e:\Pandoraflyff\Resclient %%A IN (*.*) do (
SET Original=%%~TA
SET FileName=%%A
REM COMPARE THIS FILE VS. THE CORRESPONDING ONE (SAME PATH) PATCHER
FOR %%B IN ("!FileName:Resclient=Patcher!.GZ") do (
SET Compare=%%~TB
SET FileNameCompare=%%B
if !Original! GTR !Compare! ( CALL :NEWER ) ELSE ( CALL :OLDER )
)
)
GOTO :EOF
:OLDER
echo file !FileName! !Original! is older then file !FileNameCompare! !Compare!
exit /B
:NEWER
REM echo file !FileName! !Original! is newer then file !FileNameCompare! !Compare!
set NewFileName=!FileName:Resclient=Patcher!
e:\Pandoraflyff\Batch\Program\Gzip.exe -9 -k -c -r !FileName! > !NewFileName!.gz
REM echo !NewFileName!.gz
exit /B