Using the modifier %%~tx
in the FOR
loop. You can do like this :
@echo off
set $Lim=20140101
setlocal Enabledelayedexpansion
for /f "delims=" %%a in ('dir /s /b/a-d "E:\images\*.txt"') do (
set $FileDate=%%~ta
set $FileDate=!$FileDate:~6,4!!$FileDate:~3,2!!$FileDate:~0,2!
if !$FileDate! Gtr %$Lim% echo E:\jpegoptim.exe -v --strip-all "%%~fa"
)
Test it and remove the echo
if the output is correct for you