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

Function remove_directories

methods/MIRIX/scripts/clean_cache.py:45–64  ·  view source on GitHub ↗

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

(root: Path, pattern: str)

Source from the content-addressed store, hash-verified

43
44
45def remove_directories(root: Path, pattern: str) -> int:
46 """
47 Remove all directories matching the pattern.
48
49 Args:
50 root: Root directory to search from
51 pattern: Directory name pattern to match
52
53 Returns:
54 Number of directories removed
55 """
56 count = 0
57 for dirpath in root.rglob(pattern):
58 if dirpath.is_dir():
59 try:
60 shutil.rmtree(dirpath)
61 count += 1
62 except (OSError, PermissionError) as e:
63 print(f"{Colors.RED}Warning: Could not remove {dirpath}: {e}{Colors.NC}")
64 return count
65
66
67def remove_files(root: Path, pattern: str) -> int:

Callers 1

clean_cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected