title: Unix: find directory filenames listed in a text file and move to new directory
body: <p>I'm a command line novice trying to figure out the appropriate command to execute the following within the Terminal in Mac OS X. </p>
  
  <p>Assuming I've placed all files in the same directory, I want to isolate and move a selected set of files listed in a text file in that directory to a new directory, how do I:</p>
  
  <ul>
  <li><p>read the selected list of filenames listed in a .txt file</p></li>
  <li><p>find all matches by filename</p></li>
  <li><p>isolate and move all file matches to a new directory</p></li>
  </ul>
  
  <p>I've found this to find either or both a filestring.filetype in a current directory and move all matches to a new directory:</p>
  
  <pre><code>find . -type f -iname "*filestring*.filetype" -print0| xargs -0 -J % mv % ~/NewDirectory/
  </code></pre>
  
  <p>And I've found this tar command however it creates an archive copy of each filename listed in ‘filename.txt’ </p>
  
  <pre><code>tar -cf - -T filename.txt |(cd /path/to/new/dir &amp;&amp; tar -xvf -)
  </code></pre>
  
  <p>Any help is much appreciated!</p>
  
  <p>I received an effective solution from a trusted source:</p>
  
  <pre><code>cat "filename.txt" | xargs -I % mv % ~/NewDirectory/
  </code></pre>