#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
def finder(pattern, root='.'):
matches = []
dirs = []
for x in os.listdir(root):
nd=os.path.join(root, x)
if os.path.isdir(nd):
dirs.append(nd)
elif os.path.isfile(nd) and pattern in x:
matches.append(nd)
for match in matches:
print(match)
for dir in dirs:
finder(pattern, root=dir)
finder('err',root='/usr')
冰月冷望