blob: 41601c50431189c6429f0d67888fbb467b6b3232 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import subprocess
from os import PathLike
from typing import (
Union,
)
def find(basedir: PathLike,
**flags: str | bytes) -> list[bytes]:
cmdline: list[Union[str, bytes, PathLike]] = ['find', basedir]
for key, value in flags.items():
cmdline += [f'-{key}', value]
cmdline.append('-print0')
cmd = subprocess.run(cmdline, capture_output=True)
return cmd.stdout.split(b'\0')[:-1]
|