title: Failed to copy list of files to another folder
body: <p>I have a text file called &quot;list.txt&quot; that contain all the directories of the files that need to be copied to a new folder (dir_newfolder). I wrote the code like below:</p>
  <p><code>for file in $(cat list.txt);  do cp ${file} dir_newfolder;  done </code></p>
  <p>I got list of errors: cp:&quot;file_name&quot;:No such file or directory. The file_names are the lines pulled out from the &quot;list.txt&quot;. But when I copy each file_names from the error message and use <code>cp</code> to copy to the new folder. There is no error.</p>
  <p>I am using mac os terminal.</p>
  <p>Thanks in advance.</p>