ext2/3 is hard, use find as backup

This commit is contained in:
Darryl Nixon 2023-07-16 12:20:57 -07:00
parent 155b3e2006
commit 068d47703a
2 changed files with 36 additions and 3 deletions

View file

@ -12,7 +12,6 @@ async def main(job: argparse.Namespace) -> bool:
It is called by the CLI and builds a job queue based on the arguments passed.
"""
new_paths = set()
logger.info(f"job type is {type(job)}")
# Expand all directories and files, and collect mount point information
for path in job.paths:
@ -28,9 +27,14 @@ async def main(job: argparse.Namespace) -> bool:
else:
raise TypeError(f"Not a file or directory: {path}")
# Get hardlinks to subsequently unlink for all files
# Try to delete hardlinks based on the filesystem type
job.paths = await get_all_hardlinks(new_paths)
# Just in case, use "find" to delete any remaining hardlinks
# from the mount point
for path in job.paths:
await path.delete_hardlinks_by_inode()
# Shred all physical files including hardlinks
for path in job.paths:
if isinstance(path, ShredFile):