kbzhishiku
This commit is contained in:
1 parent
7f542f54a5
commit
08a19ebe96
68 files changed
+16602
-229
No files matched your search
@@ -0,0 +1,22 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
SUPPORTED_EXTS = {".doc", ".docx", ".pdf", ".xls", ".xlsx", ".csv", ".ppt", ".pptx"}
|
||||
|
||||
|
||||
def discover(path: Path) -> list[Path]:
|
||||
if path.is_file():
|
||||
if path.name.startswith("~$"):
|
||||
return []
|
||||
return [path] if path.suffix.lower() in SUPPORTED_EXTS else []
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(path)
|
||||
files = [
|
||||
p
|
||||
for p in path.rglob("*")
|
||||
if p.is_file()
|
||||
and not p.name.startswith("~$")
|
||||
and p.suffix.lower() in SUPPORTED_EXTS
|
||||
]
|
||||
return sorted(files, key=lambda x: str(x))
|
||||
Reference in new issue
Block a user