Custom recurse globs and readme

This commit is contained in:
Darryl Nixon 2023-07-16 16:10:32 -07:00
parent 63d2d41587
commit 935c647624
3 changed files with 42 additions and 8 deletions

View file

@ -7,6 +7,7 @@ from aiopath import AsyncPath
from .classes import get_all_hardlinks
from .classes import ShredDir
from .classes import ShredFile
from .fileops import mount_bound_rglob
from .logs import logger
IGNORE_GLOBAL = ("/proc", "/dev", "/sys")
@ -84,17 +85,13 @@ async def main(job: argparse.Namespace) -> bool:
if await item.is_dir():
if str(item) in IGNORE_GLOBAL:
continue
async for subitem in item.rglob("*"):
if any(str(subitem).startswith(str(path)) for path in job.ignoredir):
continue
async for subitem in mount_bound_rglob(item, mount_point, "*", job.ignoredir):
tasks.append(check_inode_and_unlink(subitem, inodes))
else:
tasks.append(check_inode_and_unlink(item, inodes))
else:
logger.info(f"Checking non-root filesystem mount: {str(mount_point)}")
async for item in mount_point.rglob("*"):
if any(str(item).startswith(str(path)) for path in job.ignoredir):
continue
async for item in mount_bound_rglob(mount_point, mount_point, "*", job.ignoredir):
tasks.append(check_inode_and_unlink(item, inodes))
done, _ = await asyncio.wait(tasks)
for task in done: