'This method compares directories. If there is a common directory, the
algorithm must compare what is inside of the directory by calling this
recursively.'

def _compare_directories(self, left, right):

    comparison = filecmp.dircmp(left, right)
    if comparison.common_dirs:
        for d in comparison.common_dirs:
            self._compare_directories(os.path.join(left, d), os.path.join(right, d))
    if comparison.left_only:
        self._copy(comparison.left_only, left, right)
    if comparison.right_only:
        self._copy(comparison.right_only, right, left)
    left_newer = []
    right_newer = []
    if comparison.diff_files:
        for d in comparison.diff_files:
            l_modified = os.stat(os.path.join(left, d)).st_mtime
            r_modified = os.stat(os.path.join(right, d)).st_mtime
            if (l_modified > r_modified):
                left_newer.append(d)
            else:
                right_newer.append(d)
    self._copy(left_newer, left, right)
    self._copy(right_newer, right, left)
