first commit
This commit is contained in:
BIN
core/__pycache__/file_search.cpython-313.pyc
Normal file
BIN
core/__pycache__/file_search.cpython-313.pyc
Normal file
Binary file not shown.
8
core/file_search.py
Normal file
8
core/file_search.py
Normal file
@@ -0,0 +1,8 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user