API reference#
earthcarekit.utils.path
Filesystem path utilities.
Notes#
This module does not depend on other internal modules.
ensure_dir
#
ensure_file
#
extend_filepath
#
Appends a suffix to the filename before its extension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
PathLike
|
Absolute file path. |
required |
suffix
|
str
|
String to append to the filename. |
required |
Returns:
| Type | Description |
|---|---|
str
|
New file path with the suffix added. |
Source code in earthcarekit/utils/path.py
search_files_by_regex
#
Recursively searches for files matching a regex pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
PathLike
|
Root directory to search. |
required |
pattern
|
str
|
Regular expression pattern to match filenames. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Absolute paths to matching files. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
error
|
If |