Back to problems

Find Duplicate Files While Handling Symbolic-Link Cycles

System Design · Harvey · Medium

You are given the absolute path root of a directory. Explore the file tree starting from this location and return every set of distinct files whose byte-by-byte contents are exactly equal. Two files are considered distinct only if they reside at different inodes; hard links and symlinks that resolve to the same inode represent a single underlying file and should not be reported as duplicates of each other. Symbolic links should be followed only when their resolved target…

Checking your access…