I have a piece of code that I need some help with. It is supposed (in my mind at least) take two arguments, a start path and a file extension. Then when called it should return each of the file paths that are found matching the criteria. It is only returning the first file that it finds. What am I doing wrong?
# this is in a file called findFile.py def findFileExt(startPath, fileExt): for root, dirs, files in os.walk(startPath): for file in files: if file.endswith(fileExt): filePath = str(os.path.join(root, file)) return filePath # this part is in a different file calling the findFile module ip_list = findFile.getIpRange(net, start, end) for ip in ip_list: src_path = '\\\\%s\\%s\\' % (ip, start_dir) files = findFile.findFileExt(src_path, ext) print files -- http://mail.python.org/mailman/listinfo/python-list