Skip to content
Snippets Groups Projects
Commit dafedb42 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Can now specify option to search subdirectories directly to batch runner

parent 3332573d
No related branches found
No related tags found
No related merge requests found
......@@ -133,15 +133,29 @@ class FileBatchRunnerClient(HttpClient):
files = inp.get('files', [])
# get files by pattern
if pattern := inp.get('pattern'):
if pattern == '':
break
for f in list(where_local.iterdir()):
def _append_files_by_pattern(where, pattern):
matching_files = []
if pattern is None or pattern == '':
return
for f in list(where.iterdir()):
if f.is_dir():
continue
if pattern.upper() in f.name.upper() and f.name not in files:
files.append(f.name)
matching_files.append(f.name)
return matching_files
files += _append_files_by_pattern(where_local, inp.get('pattern'))
is_multiposition = inp.get('multiposition', False)
where_remote = Path(self.remote_paths['input']) / inp['directory']
# search subdirectories for pattern if so specified
if inp.get('search_subdirectories'):
for subdir in where_local.iterdir():
if not subdir.is_dir():
continue
matches = _append_files_by_pattern(subdir, inp.get('pattern'))
files += [f'{subdir}/{f}' for f in matches]
def _get_file_info(filename):
info = {
'remote_path': (where_remote / filename).as_posix(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment