I've made a simple script which finds my file test.txt, but I am trying to make it return the location of the file. It only returns whether it found the file, but I am struggling to make the function return the file path of the specified file(s), I would like it to return a list of file paths if more than one test.txt was found.
Code:
import os
wallet = 'test.txt'
filepath = 'C:\\'
def search():
for root,dirs,files in os.walk(filepath):
if wallet in files:
return 'File found'
else:
return 'Nope.. not here'
print search()