title: Powershell equivalent of cp -n, i.e. copy files without overwriting
body: <p>I frequently have to copy large numbers of files between drives, and the process often gets started and stopped. In a posix shell I can use <code>cp -n</code> to not overwrite existing files, but there doesn't seem to be an equivalent "do not overwrite" switch for <code>copy-item</code> in powershell.</p>
  
  <p>What that means is that if I have to stop and start the process I have to use</p>
  
  <pre><code>ls -Recurse|%{
      if (-Not(test-path($_fullname.replace("D:\", "E:\")))){
          cp $_.fullname $_.fullname.replace("D:\", "E:\");
      }
  }
  </code></pre>
  
  <p>Works fine, but if I have a million files to copy, as sometimes happens, I'd imagine there's going to be some overhead having to execute <code>test-path</code> every time.</p>
  
  <p>EDIT: BTW I tried <code>robocopy.exe d:\thedir e:\thedir /XN /XO /S</code>, but it took forever to scan for files that were already there. If I use the script above and I'm half way through a big session, there will be a few seconds pause before it starts copying new files; with robocopy it was spending minutes running through the already copied files, before it even started copying.</p>