title: Do..Until on a never ending loop
body: <p>I have written a <code>Do..Until</code> statement to check whether a file exists. If the file is not there, it waits a couple seconds and checks again.</p>
  
  <p>It is supposed to end when the file appears. I have tested by running the script without the file and then adding it in the folder as the script is running.</p>
  
  <p>Instead of ending, it continues to loop endlessly. Can anyone see what I have missed?</p>
  
  <pre><code>$path = test-path "C:\Temp\test.txt"
  do {    
      if (!($path)) {
          Write-Host "Not here yet..."
          Start-Sleep -s 3
      }
  } until($path)
  
  Write-Host "Files here now"
  Write-Host "Press any key to continue ..."
  $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  </code></pre>