def list_associated_files(file_path, base_name_only=False, filter_ext=''):
 if (not file_path):
  return []
 file_path_list = []
 base_name = file_path.rpartition('.')[0]
 if (not base_name_only):
  base_name = (base_name + '.')
 if (not base_name):
  return []
 base_name = re.sub('[\\[\\]\\*\\?]', '[\\g<0>]', base_name)
 if filter_ext:
  filter_ext = tuple((x.lower().strip() for x in filter_ext.split(',')))
 for associated_file_path in ek.ek(glob.glob, (base_name + '*')):
  if (associated_file_path == file_path):
   continue
  if ek.ek(os.path.isfile, associated_file_path):
   if filter_ext:
    if associated_file_path.lower().endswith(filter_ext):
     file_path_list.append(associated_file_path)
   else:
    file_path_list.append(associated_file_path)
 return file_path_list

def list_associated_files ( file_path , base_name_only = False , filter_ext = '' ) : if ( not file_path ) : return [ ] file_path_list = [ ] base_name = file_path . rpartition ( '.' ) [ 0 ] if ( not base_name_only ) : base_name = ( base_name + '.' ) if ( not base_name ) : return [ ] base_name = re . sub ( '[\\[\\]\\*\\?]' , '[\\g<0>]' , base_name ) if filter_ext : filter_ext = tuple ( ( x . lower ( ) . strip ( ) for x in filter_ext . split ( ',' ) ) ) for associated_file_path in ek . ek ( glob . glob , ( base_name + '*' ) ) : if ( associated_file_path == file_path ) : continue if ek . ek ( os . path . isfile , associated_file_path ) : if filter_ext : if associated_file_path . lower ( ) . endswith ( filter_ext ) : file_path_list . append ( associated_file_path ) else : file_path_list . append ( associated_file_path ) return file_path_list
for a given file path searches for files with the same name but different extension and returns their absolute paths file_path: the file to check for associated files base_name_only: false add extra .