I would do the actual copy with
rsync --archive --delete "fromdir/" "todir/"
This is going to be more efficient than using
rsync only copies files that have changed, and even then only copies over the change itself, rather than the entire file.
If you prefer that it not delete files in
todir that have been deleted in
fromdir, you just leave out the
--archive option basically tells it to preserve the state of the files as well as their content. Note that if you have any symbolic links in
dir1, this will copy the links themselves, and not the files they link to. Using this flag with
rsync is similar to using
Make sure you use the closing slash on
fromdir/: this tells
rsync to copy the contents of that directory, rather than the directory itself. In other words, if you leave out the final
/, you will end up with