← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Practice/Anthropic/Deduplicate Files
CodingMust
Given a root folder/directory, find all duplicate files within it. Return groups of file paths where each group contains files with identical content.
For a directory structure like:
root/ ├── a/ │ ├── f1.mp4 │ └── f2.mp4 └── b/ ├── f3.mp4 └── tmp/ └── f4.mp4
Expected output format:
[ ["a/f1.mp4", "a/f2.mp4"], # Group 1: identical content ["b/f3.mp4", "b/tmp/f4.mp4"] # Group 2: identical content ]
A straightforward solution:
os.walk() to traverse the directory tree` def find_duplicate_files(root_path: str) -> List[List[str]]: """ Find all duplicate files in the directory tree.
Args:
root_path: Root directory to search
Returns:
List of groups, where each group contains paths to duplicate files
"""
pass
`