I need to get the first appearance of the repository.config files in a directory and stop looking in the subdirectories.
Here is my directory tree:
./WAS80/base/disk1/ad/repository.config ./WAS80/base/disk1/md/repository.config ./WAS80/base/disk2/ad/repository.config ./WAS80/base/disk3/ad/repository.config ./WAS80/base/disk4/ad/repository.config ./WAS80/base/repository.config ./WAS80/fixpack/fp5/repository.config ./WAS80/fixpack_suplements/fp5/repository.config ./WAS80/supplements/disk1/ad/repository.config ./WAS80/supplements/disk1/md/repository.config ./WAS80/supplements/disk2/ad/repository.config ./WAS80/supplements/disk3/ad/repository.config ./WAS80/supplements/disk4/ad/repository.config ./WAS80/supplements/repository.config
I need the ones in bold and stop looking in the subdirectories.
I started tinkering with this code, but I couldn't figure it out.
pattern='repository.config'
path='/opt/was_binaries'
def find_all(name, path):
result = []
for root, dirs, files in os.walk(path):
if name in files:
result.append(os.path.join(root, name))
continue
return result