swectral.search_file#
- swectral.search_file(directory_path, search_pattern, end_with='', exclude_list=None)[source]#
Search and list file paths in a directory.
- Parameters:
- path
str Directory path to search.
- search_pattern
str Pattern to search. Wildcards “*” / “[]” / “?” / “[!]” are supported.
- end_with
str Filter file names ending with this pattern, extension is included. Default is empty string, which uses name extension when exists.
- exclude_list
listofstr Filter file names that contains any strings in the exclude_list.
- path
- Returns:
- Return type:
Examples
>>> search_file("/some_dir", "*abc.tif") >>> search_file("/some_dir", "abc?.tif") >>> search_file("/some_dir", "abc[123].tif") >>> search_file("/some_dir", "abc*", end_with=".tif") >>> search_file("/some_dir", "abc*", end_with=".tif", exclude_list=["mask", "test"])