title: Why does find -exec mv {} ./target/ + not work?
body: <p>I want to know exactly what <code>{} \;</code> and <code>{} \+</code> and <code>| xargs ...</code> do. Please clarify these with explanations.</p>
  
  <p>Below 3 commands run and output same result but the first command takes a little time and the format is also little different. </p>
  
  <pre><code>find . -type f -exec file {} \;
  find . -type f -exec file {} \+
  find . -type f | xargs file
  </code></pre>
  
  <p>It's because 1st one runs the <code>file</code> command for every file coming from the <code>find</code> command. So, basically it runs as: </p>
  
  <pre><code>file file1.txt
  file file2.txt
  </code></pre>
  
  <p>But latter 2 find with <code>-exec</code> commands run file command once for all files like below:</p>
  
  <pre><code>file file1.txt file2.txt
  </code></pre>
  
  <p>Then I run the following commands on which first one runs without problem but second one gives error message.</p>
  
  <pre><code>find . -type f -iname '*.cpp' -exec mv {} ./test/ \;
  find . -type f -iname '*.cpp' -exec mv {} ./test/ \+ #gives error:find: missing argument to `-exec'
  </code></pre>
  
  <p>For command with <code>{} \+</code>, it gives me the error message </p>
  
  <pre><code>find: missing argument to `-exec'
  </code></pre>
  
  <p>why is that? can anyone please explain what am I doing wrong?</p>