API reference
earthcarekit.utils.path
Filesystem path utilities.
Notes
This module does not depend on other internal modules.
extend_filepath
Appends a suffix to the filename before its extension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
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 in a directory that match a given regex pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_dirpath
|
str
|
The root directory to start the search from. |
required |
regex_pattern
|
str
|
A regular expression pattern to match file names against. |
required |
Return
list[str]: A list of absolute file paths that point to files with matching names.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the root directory does not exist. |
error
|
If the given pattern is not a valid regular expression. |