import subprocess
import glob
import pathlib
def findOpen(url, fil):
share = pathlib.WindowsPath(url)
try:
if share.exists():
path = ''
print(url)
for x in share.glob(fil):
print(x)
path = str(x)
if path != '':
print('Open : ' + path)
subprocess.Popen(['start','', path], shell=True)
except:
import traceback
traceback.print_exc()
input("Press Enter to continue...")
url = r'C:\\folder'
fil = '[!(~$)]*file name.xls?'
findOpen(url,fil)
Recommended Posts