title: How can I run a bash in every subfolder of a base folder
body: <p>I want to 'optimize' all my *.png images and found <a href="http://es.kioskea.net/faq/7287-reducir-el-tamano-de-imagenes-png" rel="nofollow noreferrer">this</a> so I made the bash as it says with:</p>
  <pre><code>#!/bin/bash    
  pngnq -vf -s1 *.png    
  rename -f 's/-nq8.png$/.png/' *.png    
  optipng -o7 *.png
  </code></pre>
  <p>And here I have 2 problems:</p>
  <p>The first one is that the second line (rename) does nothing... it is supposed to change all the images named <code>[name]-nq8.png</code> which is the result of the first line of the bash to the original name</p>
  <p>The second and main problem is: I have a folder named ImagesFolder and inside I have other folders with more *.pngs  and I want to run this bash in every subfolder of ImagesFolder but I don't know how to do it (I'm new in unix and shellscripts and so on) and what I tried didn't work or was a mess...</p>
  <p>To understand it better what I have is something like:</p>
  <pre><code>ImagesFolder
    |-Folder1
    |     |- Folder12
    |     |      |-20 images here
    |     |- Folder13
    |     |      |- 10 images more here
    |     |- 5 images here 
    |-more images
  </code></pre>
  <p>And I want the script to run from ImagesFolder</p>
  <p>Thank you so much!</p>