nicetoolbox.utils.in_out

Helper functions for input/output operations.

Functions

delete_files_into_list

Deletes the files specified in the given list of filepaths.

list_files_under_root

Lists all files under a given root.

nicetoolbox.utils.in_out.delete_files_into_list(filepath_list: list) None[source]

Deletes the files specified in the given list of filepaths.

Parameters:

filepath_list (list) – A list of filepaths to be deleted.

Returns:

None

Raises:

Exception – If the file cannot be deleted.

nicetoolbox.utils.in_out.list_files_under_root(root_path: str, ext: str = '') list[source]

Lists all files under a given root.

Parameters:
  • root_path (str) – The root path.

  • ext (str, optional) – Extension of the requested file type. Default is an empty string.

Returns:

If ext parameter is an empty string, lists all files under the given root.

Otherwise, lists the files with the given extension under the given root.

Return type:

list