Hi there, I need some help with cp files from one directory into several others. The code is as follows:
SUB=`ls src_directory | wc -l`
OUT_LOOP=$(($SUB / $MK_NUMS))
IN_LOOP=$(($SUB % $MK_NUMS))
COUNT=$MK_NUMS
while [[ $COUNT -gt 0 ]]
do
mkdir dst_directory$COUNT
ls -1 src_directory | head -$OUT_LOOP |
while read file
do
cp $file dst_directory$COUNT
done
COUNT=$(($COUNT-1))
done
However when I run the code I get the following error message ($COUNT times):
cp: cannot stat `<filename>': No such file or directory
Please help!!!