0

I am using linux, I have a file containing nearly 90 filenames of files from various locations in my HDD. I want to copy those files to a USB drive, how could i do that? The file containing filenames is in the following format :

file1
file2 
. 
. 
.
filen

I think a shell script could do that easily , but since i'm a beginner I don't know how to write it. Please provide a solution.

cyberpirate92
  • 3,076
  • 4
  • 28
  • 46
  • Would this solution help you? http://stackoverflow.com/questions/12355176/shell-script-to-copy-files-from-one-location-to-another-location – bblincoe Dec 31 '13 at 16:51

1 Answers1

2

You have to know the path to the usb drive. Then the copy command looks like

cp somefile tolocation

you'd need to put this in a loop that read the file

while read line
do
    echo $line;
    echo "do your copy here, for example cp $line /tmp/"
done < "yourfile"
Kevin Seifert
  • 3,494
  • 1
  • 18
  • 14