Skip to content

Instantly share code, notes, and snippets.

@akmurray
Created September 17, 2012 19:37
Show Gist options
  • Save akmurray/3739310 to your computer and use it in GitHub Desktop.
Save akmurray/3739310 to your computer and use it in GitHub Desktop.
REM Make thumbnails if necessary
FOR /F %%A IN ('dir /b "../../aaronkmurray-blog/img/blog/screenshots/" ^|findstr /liv "thumb"') DO (
REM "SETLOCAL ENABLEDELAYEDEXPANSION" so that we can update variables inside a loop. Those variables are wrapped in "!" instead of "%"
SETLOCAL ENABLEDELAYEDEXPANSION
REM variables
SET thumbName=%%~nA-thumb-100.png
SET thumbPath=../../aaronkmurray-blog/img/blog/screenshots/
SET thumbPathAndName=!thumbPath!!thumbName!
IF NOT EXIST !thumbPathAndName! (
ECHO Creating thumbnail for !thumbName!
convert.exe -thumbnail 100 !thumbPath!%%A !thumbPathAndName!
) ELSE (
REM ECHO Already created thumbnail for !thumbName!
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment