I am new to linux. I am trying to copy files from one path to another path. I have a text file which has all names of files in the following pattern:file-1.txtfile-2.pdffile-3.ppt....I created a .sh file with the following code: #!/bin/bashfile=`cat filenames.txt`;fromPath='/root/Backup/upload/';toPath='/root/Desktop/custom/upload/';for i in $file;do filePath=$fromPath$i #echo $filePath if [ -e $filePath ]; then   echo $filePath   yes | cp -rf $filePath $toPath else   echo 'no files' fidoneThe above code is copying only the last file name from the text instead of all to the destination path. Please help.
copy files from one path to another path in linux
bash;shell script;file copy
file=/path/to/filenames.txtfromPath=/root/Backup/upload/toPath=/root/Desktop/custom/upload/cd $fromPath && xargs mv -t $toPath < $file