Page 1 of 1

Space in file name

Posted: 2009-10-27T10:42:03-07:00
by codyhost
I am having a problem with spaces in file names. I have researched the forums and cannot solve it. I see that the reference to the file names has to be in quotes, but with the snippet of script that I found in the FAQ's, I cannot seem to get it to work.

I am using Windows XP Professional and am using this command line script.

FOR %%a in (*.jpg) DO convert %%a -resize 600x400 -quality 85 c:\test\M\%%a

I have tried putting the double quotes around the *.jpg but it will not work.

All we are trying to do is batch process many files in a single directory and put the reduced files in another directory.

Any input would be appreciated.

Re: Space in file name

Posted: 2009-10-27T10:54:16-07:00
by Bonzo
There may be something that will help you out near the bottom of this page:
http://www.rubblewebs.co.uk/imagemagick/batch.php

Or something on this page:
http://www.imagemagick.org/Usage/windows/

Re: Space in file name

Posted: 2009-10-27T11:06:57-07:00
by codyhost
Bonzo wrote:There may be something that will help you out near the bottom of this page:
http://www.rubblewebs.co.uk/imagemagick/batch.php

Or something on this page:
http://www.imagemagick.org/Usage/windows/

I have reviewed these but see no handling of the spaces in the filenames.

Perhaps I am missing something obvious.

Re: Space in file name

Posted: 2009-10-27T13:47:31-07:00
by el_supremo
See: http://www.computerhope.com/forhlp.htm
Near the middle of the webpage it explains how to quote filenames which might contain spaces.

Pete

Re: Space in file name

Posted: 2009-10-27T13:52:30-07:00
by codyhost
That got it.

Thanks.

Re: Space in file name

Posted: 2009-10-27T17:31:02-07:00
by anthony
codyhost wrote:
Bonzo wrote:Or something on this page:
http://www.imagemagick.org/Usage/windows/
I have reviewed these but see no handling of the spaces in the filenames.

Perhaps I am missing something obvious.
It is present in the IM example pages...
These modifiers can be combined, such that "%~dpn1" means "drive + path + name without extension and bracketing quotes". Consequently, we have to bracket the name by double quotes, such that the code also works for filenames including spaces. (If it doesn't, the quotes do no harm.)