rminstr.utilities.path¶
Module with custom pathing funcitons.
Functions¶
|
Validate if path is an existing file. |
|
Create local directory with an iterated name. |
|
Create a directory with an iterated name inside base_dir. |
Module Contents¶
- rminstr.utilities.path.validate_path(path, check_dirs: list[str] = None, accept_duplicates: bool = False) str¶
Validate if path is an existing file.
- Parameters:
- filenamestr
The file path to check.
- check_dirslist[str], optional
If true, will check in the directories for a file matching the original name. If found, will return a valid file path from one of those directories. The default is True.
- accept_duplicatesbool, optional
If true and files with the same basename found in the search directories, will return the first file found. Else, will throw an error. The default is False.
- Returns:
- str
Valid file path.
- rminstr.utilities.path.new_local_dir(base_name: str)¶
Create local directory with an iterated name.
- Returns:
- rel_path
Relative path to newly create local directory.
- rminstr.utilities.path.new_dir(base_dir: str, base_name: str)¶
Create a directory with an iterated name inside base_dir.
- Returns:
- path.
Absolute path to newly create local directory.