title: Bulk renaming of files in PowerShell with sequential numeric suffixes
body: <p>I have 14,000 pictures sorted into files by year and month but taken with multiple cameras and I want the file name to reflect the date taken. For example October 16, 1998 pictures are in a folder called <strong>1998\10 October\19981016</strong>. </p>
  
  <p>I want the all the pictures to be named <strong>19981016_0001 19981016_0002</strong> etc. I tried multiple suggestions but it hasn't worked.</p>
  
  <p>I can get to the point where it lists the folder I want to change but I'm unable to actually change it. All of my pictures are .jpg. </p>
  
  <p><strong>Attempts</strong>
  I created a temp file of copies in case I messed it up. I started by typing <code>cd "C:\Documents and Settings\Brooke LastName\Desktop\Temp"</code> then after successfully getting my file to load I used a formula I found on this forum.</p>
  
  <pre><code>ls *jpg | Foreach {$i=1} {Rename-Item _ -NewName ("$($.19981016){0:00000000#} .jpg" -f $i++) -whatif}
  </code></pre>
  
  <p>The error I got said</p>
  
  <pre><code>Unexpected token ' .19981016' in expression or statement.
  
  At line:1 char:12 + $.19981016 &lt;&lt;&lt;&lt;
  </code></pre>
  
  <p>The error repeated several times.</p>
  
  <p>I found several formulas on the web but most created files that would number with parentheses for example <strong>vacation (1).jpg</strong>. I want a four digit counter after an underscore at the end of my date, e.g. <strong>19981016_0001</strong></p>