for path in pathlib.Path(os.path.expanduser('~/x/y')).rglob('*'):
    f.write('{}\n'.format(path))
equivalent to the find coreutil command in python 3 for recursively returning all files and folders in a directory structure?