import os
import glob
def finder(path,mask):
os.chdir(path)
print(os.getcwd())
if len(glob.glob(mask)):
print(glob.glob(mask))
dir_list = os.listdir()
for dirt in dir_list:
if os.path.isdir(os.path.abspath(dirt)):# строка 1
print(dirt)
finder(dirt,mask)
else:
print(dirt,'is not dir')
basepath = '/path/to/directory'
for fname in os.listdir(basepath):
path = os.path.join(basepath, fname)
if os.path.isdir(path):
# skip directories
continue