title: Move-Item doesn't move file
body: <p>I've tried to rename a csv with powershell and then move it automatically to another folder, when there's no file.
  Originally, the csv-name looks like this: <em>import_9999_2020-08-13_132238.csv</em> but the part with 9999 can also include just 2 or 3 digits.
  My actual Code looks like:</p>
  <pre><code>#Import of path and target-path
  $path = &quot;\\network-path\subfolder\subfolder\subfolder\subfolder\subfolder1\&quot;
  $target_path =  &quot;\\network-path\subfolder\subfolder\subfolder\subfolder\subfolder2\&quot;
  
  
  #endless loop
  $a=$true
  while($a -eq $true){
      $Files = gci $path
      $TargetFiles = gci $target_path
      
      #wait 5 minutes if path is empty
      if(($Files).Count -eq 0){
          sleep -Seconds 300
      }
  
      #if path is filled with one or more files
      else {
          #if file in target-path is processed (from another program)
          if(($TargetFiles).count -eq 0){
              #rename and move the latest file
              get-childitem -path $path -Filter &quot;import_*.csv&quot;|
                  where-object { -not $_.PSIsContainer } | 
                  sort-object -Property $_.CreationTime | 
                  select-object -last 1 |
                  Rename-Item -NewName {($_.Name.Substring(0,($_.Name.Length)-22))+&quot;.csv&quot;} |
                  Move-Item -Destination $target_path +&quot;$($_.Name).csv&quot;
          }
           sleep -Seconds 20
      }
  }
  </code></pre>
  <p>It works partly and renames the csv, but it doesn't move it to the target-path. The path is correct, i've copied it from the Windows-Explorer.
  Any Ideas, why the program doesn't work completely? Thanks</p>