# coding: utf-8
import pathlib
from pprint import pprint as pp
file_path = r'/Users/xxxxx/anaconda'
p = pathlib.Path(file_path)
if not p.exists():
print('存在しない')
else:
pattern = '**/anaconda*.pyc'
file_list = [x.name for x in p.glob(pattern)]
pp(file_list)
print('------------------------------')
print(f'count={len(file_list)}')
pattern = 'anaconda*.pyc'
file_list = [x.name for x in p.rglob(pattern)] # rglob は recursive glob の意味
pp(file_list)
print('------------------------------')
print(f'count={len(file_list)}')