def ignored_files(adir, filenames):
    return [filename for filename in filenames if not filename.endswith('foo')]
shutil.copytree(source, destination, ignore=ignored_files)
python copytree with negated ignore pattern