get_file_paths
get_file_paths(location, file_name_pattern=None, search_subdirs=True, **kwargs)
¶
Retrieves file paths from a specified location based on the provided criteria.
This function determines the type of location (e.g., local directory, blob storage), retrieves the appropriate file retrieval strategy using a factory, and then uses that strategy to get a list of file paths that match the given file_name_pattern and search options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
The location to search for files. This could be a path to a local directory or a URI for blob storage. |
required |
file_name_pattern
|
str | None
|
The file file_name_pattern to filter by as string. None retrieves all files regardless of file_name_pattern. |
None
|
search_subdirs
|
bool
|
Whether to include files from subdirectories in the search. |
True
|
kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of file paths that match the specified criteria. The paths are returned as strings. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the |
FileUtilitiesError
|
If an error occurs while determining the location type, retrieving the strategy, or getting file paths. |
Source code in src/cloe_nessy/file_utilities/get_file_paths.py
get_location_type(location)
¶
Get the location type based on the given location string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
location
|
str
|
The location string to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
LocationType |
LocationType
|
The determined location type. |