def hellothere(somepath):
    for root, dirs, files in os.walk(somepath):
        for curfile in files:
            yield join(root, curfile)
allfiles = [x for x in hellothere('...')]
for x in hellothere('...'):
    pass
Выход в рекурсивной функции