aspcore.utilities.get_unique_folder

aspcore.utilities.get_unique_folder(prefix, parent_folder, detailed_naming=False)

Returns a unique folder name in the parent folder with the prefix and the current time

The folder name has the form parent_folder / prefix_year_month_day_hour_minute_0. If multiple folders are created within the same minute, the number is incremented by 1 for each new folder.

Parameters:
  • prefix (str) – The prefix for the folder name

  • parent_folder (Path) – The parent folder where the new folder should be created, as a Path object (from pathlib)

  • detailed_naming (bool) – If True, the folder name will include seconds and microseconds. If used with multithreading, it is a good idea to set this to True. In that case, uniqueness is not guaranteed, but it reduces the risk of clashes significantly.

Returns:

folder_name – The full path to the new folder. The folder is not created by this function.

Return type:

Path