title: How to stop the limit the search of a DIR /S after it found something
body: <p>I'm trying to look for a file in a drive in BATCH and so I used the following command:</p>
  
  <pre><code>DIR c:\directory\* /s/b | FIND "filename.txt"
  </code></pre>
  
  <p>the problem is once I find the file, it still searches… So I was wondering if there was a parameter or something that would stop the search after it found at least 1 result.</p>
  
  <p><strong>edit</strong></p>
  
  <p>I was trying something like </p>
  
  <pre><code>FOR %%G IN (DIR c:\directory\* /s/b | FIND "filename.txt") DO copy %%G 
  </code></pre>
  
  <p>then I would add another command line to exit the loop once the copy command is done.</p>