Page 1 of 1

Windows mogrify via batch

Posted: 2007-12-18T12:58:28-07:00
by ksmith
I have this quick and dirty batch file:

Code: Select all

:: Picshrink.bat
rem @echo off

:main

pushd C:\Documents and Settings\ksmith\Desktop\pics
for /R %%U in (*.jpg) do mogrify -resize 1024x768 %%U
popd
goto :eof

:: DONE
My output is a lot of:

Code: Select all

C:\Documents and Settings\ksmith\Desktop\pics>mogrify -resize 1024x768 C:\Docume
nts and Settings\ksmith\Desktop\pics\S5008330.jpg
mogrify: unable to open image `C:\Documents': No such file or directory.
mogrify: unable to open image `and': No such file or directory.
mogrify: unable to open image `Settings\ksmith\Desktop\pics\S5008330.jpg': No su
ch file or directory.
Any ideas what I'm doing wrong? Is mogrify unable to handle spaces in a path?

Thanks,
Kevin

Re: Windows mogrify via batch

Posted: 2007-12-18T13:22:08-07:00
by magick
Put quotes around your filename.

Re: Windows mogrify via batch

Posted: 2007-12-18T13:55:25-07:00
by ksmith
Geez, how did I miss that?

for /R %%U in (*.jpg) do mogrify -resize 1024x768 "%%U"
did the trick.

Thanks.