for root, dirs, files in os.walk('.'):
    for name in files:
        if name == 'foo':
            name = str(name)
name = os.path.realpath(os.path.join(root, name))
Python cant get full path name of file