From 6bcaa06f657e3a127a47059097b29ca2e86d06f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20Bj=C3=B8rke?= Date: Thu, 17 Oct 2024 14:01:28 +0200 Subject: [PATCH] Allow datafile to be name only and not include subfolders --- src/fmu/sumo/sim2sumo/common.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fmu/sumo/sim2sumo/common.py b/src/fmu/sumo/sim2sumo/common.py index 09a93d6..0e3595b 100644 --- a/src/fmu/sumo/sim2sumo/common.py +++ b/src/fmu/sumo/sim2sumo/common.py @@ -119,9 +119,13 @@ def find_datafiles(seedpoint=None): full_path = ( cwd / sp if not sp.is_absolute() else sp ) # Make the path absolute - if full_path.is_file() and full_path.suffix in valid_filetypes: - # Add the file if it has a valid filetype - datafiles.append(full_path) + if full_path.suffix in valid_filetypes: + if full_path.is_file(): + # Add the file if it has a valid filetype + datafiles.append(full_path) + else: + for filetype in valid_filetypes: + datafiles.extend([f for f in full_path.parent.rglob(f"{full_path.name}*{filetype}")]) else: for filetype in valid_filetypes: if not full_path.is_dir():