title: Adding leading zeros to a file name using PowerShell
body: <p>I have about 1500 files that name with number.jpg. for example, 45312.jpg or 342209.jpg or 7123.jpg or 9898923.jpg or 12345678.jpg</p>
  
  <p>Total number before the extension should be 8 digits. So I need to add leading zeros for if it less than 8 digit to make 8 digits file name.</p>
  
  <pre><code>00001234.jpg
  00012345.jpg
  00123456.jpg
  01234567.jpg
  </code></pre>
  
  <p>I tried this powershell script but it's complaining.</p>
  
  <p>I tried this but output is same</p>
  
  <pre><code>$fn = "92454.jpg"
  "{0:00000000.jpg}" -f $fn
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>$fn = "12345.jpg"
  $fn.ToString("00000000.jpg")
  </code></pre>