title: Rename from CSV Script renames files but trys to repeat process
body: <p>I have a script which renames files taken from a CSV but it throws an error when it trys to re-rename files after it has already carried out the successful proceedure</p>
  
  <p>CSV file is like:</p>
  
  <pre><code>old      new
  AC100    DC100
  AC101    DC102
  </code></pre>
  
  <p>Code tried:</p>
  
  <pre><code>$sourceDir = read-host "Please enter source Dir:"
  $csvL = $sourceDir + "\files.csv"
  $csv = import-csv $csvL
  $files = get-childitem $sourceDir
  $csv | % {
              ForEach( $file in $files){
              if($file = $_.old){
  
              $old = $sourceDir + "\" + $_.old
  
              Rename-Item $old $_.new
                      }       
                  }
              }
  </code></pre>
  
  <p>I beleive it is something to do with looping and the csv but im not sure where im going wrong, i have had similar issue before.</p>
  
  <p>Here is a sample of the error.</p>
  
  <pre class="lang-none prettyprint-override"><code>+             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  Rename-Item : Cannot rename because item at 'C:\scripts\2039X.67438.TXT' does not exist.
  At C:\scripts\renamerTim.ps1:18 char:15
  +             Rename-Item  &lt;&lt;&lt;&lt; $old $_.new
  </code></pre>
  
  <p>thanks in advance,
  Craig</p>