Page 1 of 1

Convert images in multiple sub-folders

Posted: 2013-09-04T01:24:53-07:00
by Waffles
I'm hoping to be able to run the convert command on a parent folder that will have multiple sub-folders nested within it. The sub-folder names will change over time, as will the image filenames. The only thing that won't change will be the output folder. I know the convert command can run on a specific folder and convert all images within it, but if I want it to search through the existing folders, convert all of the images and place them into the output folder, what command do I need to use?

I've tried using find without much luck, and mogrify doesn't seem to do what I need either, so I'm not sure whether it's actually possible?

Thanks!

Re: Convert images in multiple sub-folders

Posted: 2013-09-04T03:12:56-07:00
by snibgo
IM doesn't have a "do subdirectories" command, so you would handle that with a script, calling IM once per subdirectory, possibly recursively.

Re: Convert images in multiple sub-folders

Posted: 2013-09-04T03:38:16-07:00
by Waffles
Thanks - unfortunately as the directory names change regularly I don't think I can do that.

Re: Convert images in multiple sub-folders

Posted: 2013-09-04T04:07:33-07:00
by snibgo
A script wouldn't need to know the directory names in advance. It would loop through all the directories, whatever their names. How you do this will depend on your script language. For example, in Windows:

Code: Select all

for /D %%f in (*) do echo %%f
(If run from the console, don't double the "%".)

Re: Convert images in multiple sub-folders

Posted: 2013-09-04T05:51:08-07:00
by Waffles
Ah ok, makes sense - thanks a million :)