Files
CLARA/core/file_search.py
2025-10-21 14:18:26 +02:00

8 lines
300 B
Python

import shutil, subprocess, os
def find(pattern: str, root: str='/'):
path = os.path.expanduser(root)
if shutil.which('fd') is None:
raise RuntimeError("fd not installed")
out = subprocess.check_output(['fd', pattern, path], text=True, errors='ignore')
return out.splitlines()