I'm attempting to write a Python script which scans a drive to check whether any files, from a given list, are stored somewhere on the drive. And, if they are found - retrieve their location.
My programming skills are basic, to put it nicely.
I've written a script, with the help of people on this website, which is able to locate a single file, but I am struggling to adapt it to find more than one file.
import os 
name = ('NEWS.txt') 
path = "C:\\"
result = [] 
for root, dirs, files in os.walk(path): 
    if name in files: 
        result.append(os.path.join(root, name) + "\n") 
f = open ('testrestult.txt', 'w') 
f.writelines(result)
Any advice would be appreciated!
Many thanks.
 
     
    