title: Batch resize and rename image files in subdirectories
body: <p>I'm trying to resize and rename several hundred subdirectories of images. The files that I need to be changed:</p>
  
  <ul>
  <li>End with A.jpg</li>
  <li>Need to be resized down to 400x400</li>
  <li>Renamed to A@2x.jpg</li>
  </ul>
  
  <p>Example: 
  images/**/A6919994719A@2x.jpg</p>
  
  <p>I got the resizing bit down in one directory. I'm having some trouble finding a way to rename just the end of the file, not the extension, and executing it through the subdirectories. </p>
  
  <p>Any help would be appreciated.</p>
  
  <pre><code>#!/bin/bash
  
  for i in $( ls *A.jpg); do convert -resize 400x400 $i
  </code></pre>