Given a nested directory structure containing various files, I would like to find all the files within it, but where there are multiple files with the same name, I'd like to return just the largest file.
So, for example, given a directory structure like:
|--- foo.jpg (110 KB) |--- bar.jpg (210 KB) |--- dir |----- foo.jpg (860 KB) |----- baz.jpg (200 KB)
I'd like to produce the output lines (order unimportant):
bar.jpg dir/foo.jpg dir/baz.jpg
How can I do this, preferably from bash?