Index

cosmo_utils.utils.file_utils.Index(pathdir, datatype, sort=True, basename=False)[source] [edit on github]

Indexes the files in a directory pathdir with a specific data type datatype.

Parameters:

pathdir : string

Path to the directory being analyzed

datatype : string

Type of documents to look for.

sort : bool, optional (default = True)

If this is set to True, the output list is sorted by name

basename : bool, optional

If this is set to True, the output list will contain only the basename of the files in pathdir

Returns:

file_arr : np.ndarray

List of (sorted) files in pathdir with datatype datatype