File system · 14 / 15 Exercise Hard

Duplicate files

Objective

The program runs inside a folder that already contains the files of the test case. Two files are duplicates if they have exactly the same content, even if their name is different. A dictionary whose key is the content (read_bytes()) groups the equal files.

Instructions

  • Walk the current folder and all its subfolders.
  • For each group of files with the same content (two or more) show one line with their sorted relative paths separated by = . Groups are shown sorted.
  • If there are no duplicates, show No duplicates.

Example. If a.txt, b.txt and d/e.txt have the same content and c.txt a different one, it shows a.txt = b.txt = d/e.txt.

Output
a.txt = b.txt = d/e.txt

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise