Synchronization in copying multiple files to a directory

Hi Friends,

My goal is to copy 1000 of files of same filesize simultaneously to a directory. i.e i do multiple copies into a same directory. What i feel here is, at some 1000th iteration, few transfers ends in advance before some transfers start. I need to get synchronized file transfers so that all the 1000 copies run simultaneously.

To achieve this, i follow the below procedure.

i stop all the cp processes when they start and continue them after reaching 1000th cp. What is happening here is the cp does not stop at same filesize and continuing them again results in the same synchronization problem. i.e few transfers ends in advance before some transfers continue again. Am not sure whether this could be possible to achieve synchronization or am following wrong procedure.

My script is below.

declare -a mypid

for((i=0;i<1000;i++))
do
myvar="File$i.txt"
./cp_child.sh $i &
mypid[$i]=`ps -w aux | awk '/'"$myvar"'/ && !/awk/ { print $2 }'`
kill -s SIGSTOP ${mypid[$i]}
done
sleep 50
for((i=0;i<1000;i++))
do
kill -s SIGCONT ${mypid[$i]}
done

Code of cp_child.sh is

FILENAME="/home/TestFiles/FILE_250MB.txt"
WR_PATH="/home/MyTest/File$1.txt"
RD_PATH="/home/TestFiles/Read/Readfile$1.txt"
cp $FILENAME $WR_PATH
cp $WR_PATH $RD_PATH
cmp $FILENAME $RD_PATH

Also, is it possible to stop the cp process at specific filesize? If so, how to monitor the written file for its changing file size?

Thanks for ur patience.
Awaiting possible solutions.
Amio

You are looping 1000 times and fork/exec'ing a shell script. This alone precludes "synchronized file transfers so that all the 1000 copies run simultaneously."