Q:

How to run guetzli on all Jpeg images in a folder, and subfolders

I have just com across https://github.com/google/guetzli - And would like to write a script to run it on all jpeg images in a project on windows.
How would I loop though, all files in the folder and sub folder and get the relative paths to input into the command? Finally as guetzli is reasonably slow is there a way to wait for the execution to finish or put a delay in? 
Thanks,
Lewis

A:

For anyone interested, this is the code I went for;
setlocal disableDelayedExpansion
for /f "delims=" %%A in ('forfiles /s /m *.jpg /c "cmd /c echo @relpath"') do 
(
  set "file=%%~A"
  setlocal enableDelayedExpansion
  echo !file:~2!
  CALL "guetzli.exe" --quality 85 !file:~2! !file:~2!
  endlocal
)

Just put it into put it into the root directory with the guetzli executable

