def METHOD_NAME(self, directory):
    for (dirpath, _, filenames) in os.walk(directory):
        for filename in filenames:
            fullPath = os.path.join(dirpath, filename)
            statinfo = os.stat(fullPath)
            file_age_days = (time.time() - statinfo.st_ctime) / (60 * 60 * 24)
            # prune repodata so yum redownloads.
            # prevents certain errors where yum gets stuck due to bad metadata
            for ext in self.METADATA_EXTS:
                if filename.endswith(ext) and file_age_days > self.yum_cache_opts['max_metadata_age_days']:
                    os.unlink(fullPath)
                    fullPath = None
                    break
            if fullPath is None:
                continue
            if file_age_days > self.yum_cache_opts['max_age_days']:
                os.unlink(fullPath)
                continue