MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / remove_files

Function remove_files

methods/MIRIX/scripts/clean_cache.py:67–86  ·  view source on GitHub ↗

Remove all files matching the pattern. Args: root: Root directory to search from pattern: File name pattern to match Returns: Number of files removed

(root: Path, pattern: str)

Source from the content-addressed store, hash-verified

65
66
67def remove_files(root: Path, pattern: str) -> int:
68 """
69 Remove all files matching the pattern.
70
71 Args:
72 root: Root directory to search from
73 pattern: File name pattern to match
74
75 Returns:
76 Number of files removed
77 """
78 count = 0
79 for filepath in root.rglob(pattern):
80 if filepath.is_file():
81 try:
82 filepath.unlink()
83 count += 1
84 except (OSError, PermissionError) as e:
85 print(f"{Colors.RED}Warning: Could not remove {filepath}: {e}{Colors.NC}")
86 return count
87
88
89def clean_cache() -> List[Tuple[str, int]]:

Callers 1

clean_cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected