def getFiles(wc_name):
# assume wild card is in the last part
path, file = os.path.split(wc_name)
returnable = []
if '*' in path:
raise ValueError('must implement getFiles better')
try:
a, dirs, files = next(os.walk(os.path.normpath(path)))
except StopIteration:
return returnable
for com in files:
rematcher = wc_name.replace('/', '\\').replace('\\', '\\\\').\
replace('.', '\\.').\
replace('*', '.*').\
replace('(', '\\(').\
replace(')', '\\)')
if re.fullmatch(rematcher, path.replace('/', '\\')+ '\\' + com):
returnable.append(os.path.join(path, com))
return returnable
评论列表
文章目录