diff --git a/melamine/shred.py b/melamine/shred.py index 34834d7..316d04c 100644 --- a/melamine/shred.py +++ b/melamine/shred.py @@ -27,6 +27,9 @@ async def main(job: argparse.Namespace) -> bool: raise TypeError(f"Not a file or directory: {path}") new_paths = set(await asyncio.gather(*tasks)) + # Try to delete hardlinks based on the filesystem type + job.paths = await get_all_hardlinks(new_paths) + # Shred all physical files including hardlinks for path in job.paths: tasks = [] @@ -40,9 +43,6 @@ async def main(job: argparse.Namespace) -> bool: if e: logger.warning(f"Error raised while shredding: {e}") - # 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, so let's build a map of inodes to mount points logger.info("Deleting remaining hardlinks using find")