title: How should I batch make thumbnails with the original images located in multiple subdirectories?
body: <p>I have the original images in a directory structure that looks like this:</p>
  
  <pre><code>./Alabama/1.jpg
  ./Alabama/2.jpg
  ./Alabama/3.jpg
  ./Alaska/1.jpg
  ...the rest of the states...
  </code></pre>
  
  <p>I wanted to convert all of the original images into thumbnails so I can display them on a website.  After a bit of digging / experimenting, I came up with the following Linux command:</p>
  
  <pre><code>find . -type f -iname '*.jpg' | sed -e 's/\.jpg$//' | xargs -I Y convert Y.jpg -thumbnail x100\&gt; Y-small.jpg
  </code></pre>
  
  <p>It recursively finds all the jpg images in my subdirectories, removes the file type (.jpg) from them so I can rename them later, then makes them into a thumbnail and renames them with '-small' appended before the file type.</p>
  
  <p>It worked for my purposes, but its a tad complicated and it isn't very robust.  For example, I'm not sure how I would insert 'small-' at the beginning of the file's name (so <code>./Alabama/small-1.jpg</code>).</p>
  
  <p>Questions:</p>
  
  <ol>
  <li>Is there a better, more robust way of creating thumbnails from images that are located in multiple subdirectories?</li>
  <li>Can I make the existing command more robust (for example, but using <code>sed</code> to rename the outputted thumbnail before it is saved- basically modify the Y-small.jpg part).</li>
  </ol>