title: Trying to rename certain file types within recursive directories
body: <p>I have a bunch of files within a directory structure as such:</p>
  
  <pre><code>Dir
      SubDir
              File
              File
      Subdir
              SubDir
                        File
              File
      File
  </code></pre>
  
  <p>Sorry for the messy formatting, but as you can see there are files at all different directory levels. All of these file names have a string of 7 numbers appended to them as such: 1234567_filename.ext. I am trying to remove the number and underscore at the start of the filename.</p>
  
  <p>Right now I am using bash and using this oneliner to rename the files using mv and cut:</p>
  
  <pre><code>for i in *; do mv "$i" "$(echo $i | cut -d_ -f2-10)"; done
  </code></pre>
  
  <p>This is being run while I am CD'd into the directory. I would love to find a way to do this recursively, so that it only renamed files, not folders. I have also used a foreach loop in the shell, outside of bash for directories that have a bunch of folders with files in them and no other subdirectories as such:</p>
  
  <pre><code>foreach$ set p=`echo $f | cut -d/ -f1`
  foreach$ set n=`echo $f | cut -d/ -f2 | cut -d_ -f2-10`
  foreach$ mv $f $p/$n
  foreach$ end
  </code></pre>
  
  <p>But that only works when there are no other subdirectories within the folders.</p>
  
  <p>Is there a loop or oneliner I can use to rename all files within the directories? I even tried using <code>find</code> but couldn't figure out how to incorporate <code>cut</code> into the code.</p>
  
  <p>Any help is much appreciated.</p>