Need script using cp to transfer files to another folder

Hi guys ,

how are you doing?

I am tryng to make a script using cp that i would like to do this:

echo "Enter the name files to tranfer"

then user has to enter via keyboard this kind of output

file1 file 2 file 3 file x

(i mean the number of the files could vary and their name too)

then i need to copy those files that user had entered to a specific folder..

any idea on how to do this?

thanks for your support.

Rex:):slight_smile:

easy enough:

printf "Type filenames: "
read FILENAMES

cp $FILENAMES /path/to/dest

$FILENAMES will automatically split on spaces for you since it's not inside double quotes.