pyslk.group_files_by_tape#
- pyslk.group_files_by_tape(resource_path: Path | str | list | None = None, search_id: str | int | None = None, search_query: str | None = None, recursive: bool = False, max_tape_number_per_search: int = -1, run_search_query: bool = False) list[dict] #
Group files by tape id.
Group a list of files by their tape id. Has not all arguments of the slk_helpers group_files_by_tape cli call. Please us
pyslk.count_tapes()
to count the number of tapes onto which files are stored on.- Parameters:
resource_path (
str
,list
,Path
) – list of files or a namespaces with files that should be grouped.search_id (
int
,str
) – id of a searchsearch_query (
str
) – a search queryrecursive (
bool
) – do recursive search in the namespacesmax_tape_number_per_search (
int
) – number of tapes per search; if ‘-1’ => the parameter is not setrun_search_query (
bool
) – generate and run (a) search query strings instead of the lists of files per tape and print the search i, Default: False
- Returns:
A list of dictionaries containing group and tape info.
- Return type:
list[dict]
See also
Examples
>>> import pyslk as slk >>> slk.group_files_by_tape(["/test/test3/ingest_01_102", "/test/test3/ingest_01_339"]) [{'id': -1, 'location': 'cache', 'label': '', 'status': '', 'file_count': 2, 'files': ['/test/test3/ingest_01_102', '/test/test3/ingest_01_339'], 'search_query': '{"$and":[{"path":{"$gte":"/test/test3","$max_depth":1}}, {"resources.name":{"$regex":"ingest_01_102|ingest_01_339"}}]}', 'search_id': 416837}]