I am currently trying to search for a list of missing attachments that are scattered throughout our file share server.I have a txt file with a list of filenames I would like to find. Ideally at some point I would like to copy the file to another location when found. At this moment it doesn't seem to be working, because it returns no results and I have verified the files exist.
import os
source = open("Test.txt", "r")
dest = '//somewhere/somefolder'
path = '//somewhere/anotherfolder'
for line in source:
print 'Searching . . .'
print line
for root, dirs, files in os.walk(path):
for name in files:
if name in line:
# shutil.copy(os.path.join(root, name), dest)
print 'Found!'
print path, name
print 'Done';