I am using a command:
xargs -a file_list.txt cp -t /path/to/dest
but the filenames with whitespace get cut and therefore are not copied.
what can be done?
Xargs is nice/fast/etc but isn't easy to understand for novices in shell scripting.
I think that's will be much more readable (and more clean than for with subshell).
#!/bin/bash
while read filename; do
cp -a "$filename" /path/to/dest
done < file_list.txt
You can do this
IFS=$'\n' ; for file in `cat file_list.txt` ; do cp $file /path/ ; done
Explanation
If it were a shell script and nicely formatted
#!/bin/bash
IFS=$'\n'
for file in `cat file_list.txt` ; do {
cp $file /path/
} done