我目前正在尝试查找标题中包含某个关键字的文档。我已经在某种程度上成功了,但并不健壮。我正在寻找的关键字是“月度报告”。有没有办法搜索这个关键字,而不区分大小写?目前有一些文件被排除,因为它们是标题“月度报告”或“月度报告”等。这是我迄今为止所拥有的。提炼关键字文件名搜索
import os
import shutil
dest = '//server/to_user/folder'
path = '//server/from_user/'
keyword = 'Monthly Report'
for root, dirs, files in os.walk(path):
for name in files:
if keyword in name:
#shutil.copy(path + name, dest)
print name
这样做了,谢谢! – wisenhiemer