I am trying to write a script that will copy all file listed in a text file (100s of file names) to a new directory
Assume script will run with main as current working directory and I know how many files/lines will be in List.txt
Im trying to work up a test script using this model
Contents of main
script.sh
sort < is a folder
List.txt
stuff.pdf
misc.rtf
junk.txt
thing.txt
Contents of List.txt
stuff.pdf
misc.rtf
thing.txt
Script so far (contests of script.sh)
#1/bin/bash
count =0
while [ $count -le 3 ]
do
filename= sed -n '1p' List
cp $filename sort
count=$(($count + 1 ))
done
2 things 2 Do
(1)
count though lines with counter
something like
filename= sed -n '$countp' List
(2)
use the file name stored in $filename in copy command
right now its viewing sort as the source not the destination $filename is not being read in
Its a small script but any help would be appreciated