title: ImageMagick thumbnail Batch processing on Windows
body: <p>I am using ImageMagick to create thumbnails of photos.</p>
  
  <p>I am using windows OS.</p>
  
  <p>My source files are contained in numerous sub folders.</p>
  
  <p>I wish to make thumbnails of the source files by saving to a destination folder on a different drive while preserving the same folder structure and modifying the original filename.</p>
  
  <p>The destination file name is the same as the source but with 1 character modified:</p>
  
  <p>Source examples:</p>
  
  <pre><code>c:\images\1\1L0000021.jpg
  c:\images\1\1L000561.jpg
  c:\images\2\234L0000032.jpg
  c:\images\3\31214L000001.jpg
  </code></pre>
  
  <p>To dest drive:</p>
  
  <pre><code>d:\images\1\1M0000021.jpg
  d:\images\1\1M000561.jpg
  d:\images\2\234M0000032.jpg
  d:\images\3\31214M000001.jpg
  </code></pre>
  
  <p><em>Note: only one letter need be changed from L to M</em></p>
  
  <p>The source filename pattern is always: <code>*l*.jpg</code></p>
  
  <p>Here is the command I want to run to do the image processing:</p>
  
  <pre><code>convert -thumbnail 200x220^^ -gravity center -extent 200x200 -quality 80 c:\images\*.jpeg d:\images\output.jpeg
  </code></pre>
  
  <p>The above command creates the desired thumbnails from the source folder and saves into the  destination folder but the output filename is incorrect and it does not traverse sub folders.</p>
  
  <p><strong>Questions:</strong></p>
  
  <p>1) how to traverse each folder and subfolder and then output to the exact same structure on the destination drive (create the folders if they don't exist)</p>
  
  <p>2) how to modify the output filename so that <code>*l*.jpeg</code> becomes <code>*m*.jpeg</code></p>