import subprocess
import glob
import pathlib
def find(url, fil):
share = pathlib.WindowsPath(url)
try:
if share.exists():
print(url)
for x in share.glob(fil):
print(str(x).replace(url, ''))
return True
except:
import traceback
traceback.print_exc()
input("Press Enter to continue...")
return False
def doFunc():
print('検索キーワードを入力して下さい')
word = input()
if word:
print('キーワード 『'+word+'』で検索中です。')
url = r'D:\\対象フォルダ'
fil = '**/[!(~$)]*' + word + '*.*'
return find(url,fil)
else:
return True
input("検索が完了しました。\nEnterキーを押すと処理を終了します。")
while doFunc():
print('処理を継続します!\n'+"-"*100)