forked from PanDAWMS/pilot3
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Nilsson
committed
Oct 31, 2023
1 parent
7449b68
commit e5feb2d
Showing
6 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.6.10.30 | ||
3.6.10.31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
# Authors: | ||
# - Paul Nilsson, [email protected], 2017-23 | ||
|
||
import fnmatch | ||
import hashlib | ||
import io | ||
import logging | ||
|
@@ -1339,3 +1340,23 @@ def append_to_file(from_file: str, to_file: str) -> bool: | |
logger.warning(f"an error occurred while processing the file: {exc}") | ||
|
||
return status | ||
|
||
|
||
def find_files_with_pattern(directory, pattern): | ||
""" | ||
Find files in a directory that match a specified pattern. | ||
:param directory: The directory to search for files (str) | ||
:param pattern: The pattern to match filenames (str) | ||
:return: a list of matching filenames found in the directory (list). | ||
""" | ||
|
||
try: | ||
if not os.path.exists(directory): | ||
raise FileNotFoundError(f"directory '{directory}' does not exist") | ||
|
||
# return all matching files | ||
return [f for f in os.listdir(directory) if fnmatch.fnmatch(f, pattern)] | ||
except (FileNotFoundError, PermissionError) as exc: | ||
logger.warning(f"exception caught while finding files: {exc}") | ||
return [] |