Reputation: 179
Right now I have the following batch file that I use to process my images:
@echo none
cd %1
md "%~1\ProcessedJPEGS"
for %%i in (*.jpg) do "C:\Program Files\Image Optimization\jpegtran.exe" -optimize -progressive -copy none "%%i" "%~1\ProcessedJPEGS\%%i"
move /Y "%~1\ProcessedJPEGS\*.*" "%~1"
rd "%~1\ProcessedJPEGS"
pause
As you can see, this is not ideal but my skills are laughable at best so I need some help here :)
What I want to accomplish is to run this batch in a directory and process all images recursively and overwrite them.
Thanks in advance, Arky
Upvotes: 3
Views: 3627
Reputation: 41242
Based upon your command line, this should process all JPG files from the current folder and below. Test it on a sample set of files/folders to be sure it works for you.
@echo none
for /f "delims=" %%a in ('dir "*.jpg" /b /s /a-d') do (
echo processing "%%a"
"C:\Program Files\Image Optimization\jpegtran.exe" -optimize -progressive -copy none "%%a" "%%a.tmp"
move /Y "%%a.tmp" "%%a" >nul
)
pause
Upvotes: 8