title: Rename multiple files by wildcard (batch/powershell)
body: <p>I have several log files which is named by the following pattern Log_yyyy_M_d.log</p>
  
  <pre><code>Log_2010_7_1.log
  Log_2010_7_2.log
  Log_2010_7_3.log
  Log_2010_7_4.log
  Log_2010_7_5.log
  etc....
  </code></pre>
  
  <p>I want to merge all of them to a single file where the content is orded by date.</p>
  
  <p>So I've come up with something like this: </p>
  
  <pre><code>for %f in (*.log) do type “%f” &gt;&gt; mergedlogs.txt
  </code></pre>
  
  <p>They are however not added to the mergedlogs.txt file ordered by date (asc).  How may I accomplish that using standard shell/powershell scripts? I was hoping to avoid having to create a small .exe to solve this (in reality I guess that would have saved me a lot of time instead trying to do this in shell scripts).</p>
  
  <p>One approach is to have merge syntax do a order by, but then I would have to rename the files to another pattern Log_yyyy_MM_dd.log</p>
  
  <p>Can't seem to get shell scripting to do a multiple rename by wildcards</p>
  
  <p>dir *<em>?</em>?.log and dir *_?.log should give me all the filenames which I need to rename, but this syntax is not giving me the desired result</p>
  
  <pre><code>ren *_?.log *_0?.log
  </code></pre>
  
  <p>This would be the desired rename result: Log_2010_12_1.log >> Log_2010_12_01.log</p>
  
  <p>Any help with the shell rename script (or powershell) would be appreciated, or maybe another approach to achieve the main goal which is to merge all the log files to a single file where the content is order by filename-date.</p>