Welcome, guest | Sign In | My Account | Store | Cart
import os

def findInSubdirectory(filename, subdirectory=''):
    if subdirectory:
        path = subdirectory
    else:
        path = os.getcwd()
    for root, dirs, names in os.walk(path):
        if filename in names:
            return os.path.join(root, filename)
    raise 'File not found'

History

  • revision 2 (14 years ago)
  • previous revisions are not available