Thank you GrapefruitGirl,
there was one minor problem, here's a working version:
Code:
#!/bin/bash
#Script to synchronize two directories
DIR1=path/to/dir1
DIR2=path/to/dir21
for i in $DIR1/* ; do
cp -Rup "$i" "$DIR2/`basename $i`"
done
for i in $DIR2/* ; do
cp -Rup "$i" "$DIR1/`basename $i`"
done