title: Batch renaming replace with part of the original file name DOS and Bash
body: <p>I know this has been covered many times, but i still can't seem to get a good solution to this particular aspect.  I have the same problem in both bash and DOS.  I have a file of many .csv files named abcYYMMDDf.csv and I want to change the file name to the YYMMDD part which corresponds to the date it was created.  Note the "f" after the YYMMDD, so really i would like an equivalent of excel's mid() to take the middle date.</p>
  
  <p>In bash I understand the rename function, and the * wildcard I tried variations on</p>
  
  <pre><code>rename abc*f.csv *.csv abc*
  </code></pre>
  
  <p>thinking that the * would stand in for YYMMDD but obviously it didn't.
  I saw another method involving selecting s/([a-z]*) but that would just take the whole file name surely?</p>
  
  <p>In DOS I tried</p>
  
  <pre><code>ren abc*f.csv *.csv
  </code></pre>