title: Rename-item: Cannot rename because item at ... does not exist
body: <p>I am lost with simple rename-item. Need to change names of folders to &quot;01&quot;, &quot;02&quot;, &quot;03&quot;... Tried everything but at the end I get this &quot;Item doesn't exist&quot;. Sorry for dumb question but I am looking for a solution all day.</p>
  <pre><code>PS C:\Users\admin&gt; 
  $nr = 1
  
  Dir E:&quot;Data-test&quot; | %{Rename-Item $_ -NewName (‘{0}’ -f $nr++)}
  
  Rename-Item : Cannot rename because item at 'ert' does not exist.
  At line:3 char:23
  + Dir E:&quot;Data-test&quot; | %{Rename-Item $_ -NewName (‘{0}’ -f $nr++)}
  +                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [Rename-Item], PSInvalidOperationException
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand
   
  Rename-Item : Cannot rename because item at 'ukh' does not exist.
  At line:3 char:23
  + Dir E:&quot;Data-test&quot; | %{Rename-Item $_ -NewName (‘{0}’ -f $nr++)}
  +                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [Rename-Item], PSInvalidOperationException
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand
   
  Rename-Item : Cannot rename because item at 'yph' does not exist.
  At line:3 char:23
  + Dir E:&quot;Data-test&quot; | %{Rename-Item $_ -NewName (‘{0}’ -f $nr++)}
  +                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [Rename-Item], PSInvalidOperationException
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand
  </code></pre>