def getAllDirectoriesWithFile(path, filename, excludeDirs):
 directoryList = []
 for (dirpath, dirnames, filenames) in os.walk(path):
  for d in dirnames[:]:
   if (d in excludeDirs):
    dirnames.remove(d)
    print ('EXCLUDING %s...' % os.path.join(dirpath, d))
   elif ('UNDER_DEVELOPMENT' in os.listdir(os.path.join(dirpath, d))):
    dirnames.remove(d)
    print ('EXCLUDING %s...' % os.path.join(dirpath, d))
  for f in filenames:
   if (f == filename):
    directoryList.append(dirpath)
 return directoryList

def getAllDirectoriesWithFile ( path , filename , excludeDirs ) : directoryList = [ ] for ( dirpath , dirnames , filenames ) in os . walk ( path ) : for d in dirnames [ : ] : if ( d in excludeDirs ) : dirnames . remove ( d ) print ( 'EXCLUDING %s...' % os . path . join ( dirpath , d ) ) elif ( 'UNDER_DEVELOPMENT' in os . listdir ( os . path . join ( dirpath , d ) ) ) : dirnames . remove ( d ) print ( 'EXCLUDING %s...' % os . path . join ( dirpath , d ) ) for f in filenames : if ( f == filename ) : directoryList . append ( dirpath ) return directoryList
returns a list of directories in the <path> with a given <filename> .