I had an embarrassingly round-about answer here earlier, but Denis's answer reminded me that I missed the most basic thing. So, I deleted my original answer. But since nobody has said this very basic thing, I think it's worth putting it here.
The original question is "I have a text file with a list of space-separated names of files. How can I copy those to one target directory." At first this might seem tricky or complicated, because you think you have to somehow extract the items from the file in a specific way. However, when the shell processes a command line, the first thing it does is separate the argument list into tokens and (here's the bit nobody has said outright) spaces separate tokens. (Newlines also separate tokens which is why Doug Harris's test with a newline separated list had the same result.) That is, the shell expects and can already handle a space-separated list.
So all you need to do here is put the space-separated list (that you already have) into the right place in your command. Your command is some variation on this:
cp file1 file2 file3...file# target
The only wrinkle is that you want to get the list of files 1 through # from your text file.
As Dennis points out in his comment, your original attempt (
new_folder) should have worked already. Why? Because the internal command
cat list.txt is processed first by the shell and expands into
file1 file2 file3...file#, which is exactly what the shell expects and wants at that part of the command. If it didn't work then either (1) you had a typo or (2) your filenames were somehow strange (they had spaces or other unusual characters).
The reason that all Dennis's answers work is simply that they provide the necessary list of files for
cp to work on, placing that list where it belongs in the entire command. Again, the command itself is this in structure:
cp list-of-files target_directory
It's easy to see how this all comes together in this version:
cp $(<list.txt) new_folder
$() causes the shell to run the command inside the parentheses and then substitute its output at that point in the larger line. Then the shell runs the line as a whole. By the way,
$() is a more modern version of what you were already doing with backticks (`). Next:
< is a file redirection operator. It tells the shell to dump the contents of
list.txt to standard input. Since the
$() bit gets processed first, here's what happens in stages:
cp $(<list.txt) new_folder
# split line into three tokens: cp, $(<list.txt), new_folder
cp file1 file2 file3...file# new_folder
# substitute result of $(<list.txt) into the larger command
Obviously step 2 is simply the normal
cp command you wanted.
I realize that I'm beating this (perhaps very dead) horse a lot, but I think it's worth doing. Understanding exactly how the shell processes a command can help you to write it better and simplify a lot. It will also show you where problems are likely to be hiding. In this case, for example, in hindsight, my first question to you should have been about funny filenames or a possible typo. No acrobatics were necessary.