def compare_recursive_mtime(path, cutoff, newest=True):
if os.path.isfile(path):<EOL><INDENT>mt = mtime(path)<EOL>if newest:<EOL><INDENT>if mt > cutoff:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif mt < cutoff:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>for dirname, _, filenames in os.walk(path, topdown=False):<EOL><INDENT>for filename in filenames:<EOL><INDENT>mt = mtime(pjoin(dirname, filename))<EOL>if newest:  <EOL><INDENT>if mt > cutoff:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif mt < cutoff:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Compare the newest/oldest mtime for all files in a directory.

    Cutoff should be another mtime to be compared against. If an mtime that is
    newer/older than the cutoff is found it will return True.
    E.g. if newest=True, and a file in path is newer than the cutoff, it will
    return True.