def pfindall(path, *fnames):
    """Find all fnames in the closest ancestor directory.
       For the purposes of this function, we are our own closest ancestor.
       I.e. given the structure::

            .
            `-- a
                |-- b
                |   |-- c
                |   |   `-- x.txt
                |   `-- x.txt
                `-- y.txt

       the call::

           dict(pfindall('a/b/c', 'x.txt', 'y.txt'))

       will return::

           {
               'x.txt': 'a/b/c/x.txt',
               'y.txt': 'a/y.txt'
           }

       ``a/b/x.txt`` is not returned, since ``a/b/c/x.txt`` is the "closest"
       ``x.txt`` when starting from ``a/b/c`` (note: pfindall only looks
       "upwards", ie. towards the root).
    """
    wd = os.path.abspath(path)
    assert os.path.isdir(wd)

    def parents():
        """yield successive parent directories
        """
        parent = wd
        yield parent
        while 1:
            parent, dirname = os.path.split(parent)
            if not dirname:
                return
            yield parent

    for d in parents():
        curdirlist = os.listdir(d)
        for fname in fnames:
            if fname in curdirlist:
                yield fname, os.path.normcase(os.path.join(d, fname))