def relative_wildcard_glob(dirname, pattern):
 if (not dirname):
  dirname = os.curdir
 try:
  if ('**' in pattern):
   names = list(_iter_relative_dirs(dirname))
  else:
   names = os.listdir(dirname)
 except OSError:
  return []
 result = []
 pattern = os.path.normcase(pattern)
 match = re.compile(translate(pattern)).match
 for name in names:
  if match(os.path.normcase(name)):
   result.append(name)
 return result

def relative_wildcard_glob ( dirname , pattern ) : if ( not dirname ) : dirname = os . curdir try : if ( '**' in pattern ) : names = list ( _iter_relative_dirs ( dirname ) ) else : names = os . listdir ( dirname ) except OSError : return [ ] result = [ ] pattern = os . path . normcase ( pattern ) match = re . compile ( translate ( pattern ) ) . match for name in names : if match ( os . path . normcase ( name ) ) : result . append ( name ) return result
non-recursive glob for one directory .