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('Please enter a search keyword')
        word = input()
        if word:
                print('Keyword "'+word+'] Is being searched.')
                url = r'D:\\Target folder'
                fil = '**/[!(~$)]*' + word + '*.*'
                return find(url,fil)
        else:
                return True
        input("The search is complete.\n Press the Enter key to end the process.")
while doFunc():
        print('Continue processing!\n'+"-"*100)
        Recommended Posts