sync_files() {
    local source=${1:-}
    local destination=${2:-}
    local dry_run=${3:-}


    if [ -z "${destination}" ]; then
        >&2 echo "ERROR: missing destination"
    elif [ -z "${source}" ]; then
        >&2 echo "ERROR: missing source"
    elif [ ! -d "${destination}" ]; then
        >&2 echo "ERROR: destination directory does not exist: ${destination}"
    elif [ ! -d "${source}" ] && [ ! -f "${source}" ]; then
        >&2 echo "ERROR: source directory or file does not exist: ${source}"
    elif [ -n "${dry_run}" ]; then
        rsync                \
            --archive        \
            --dry-run        \
            --human-readable \
            --verbose        \
            "${source}"      \
            "${destination}" \
            ;
    else
        rsync                \
            --archive        \
            --human-readable \
            --verbose        \
            "${source}"      \
            "${destination}" \
            ;
    fi
}
