I have quite a interesting problem and I've been struggling to find a solution. The situation is this:
I have two directories containing lots of files and folders (tens of thousands). Some of the files between those two directories are identical in size, but different in file names, file paths and content. I need to automatically find and replace same size files in the first directory with the ones from the second one, ignoring directory structure and file names of the second directory.
I've been trying to use fdupes as well as other similar tools, but they compare file contents, so it's not an option.
I've tried using gnome-search-tool to list all files and sort them by size, but replacing them manually is nuts as there are thousands of them.
I've been exploring solution presented in https://stackoverflow.com/questions/7541616/how-to-find-files-with-same-size, but none could fit my needs.
Could somebody point me to the right solution?
find dir1 dir2 -type f -print0 | xargs -0 -r stat --format="%s %n" | sort -n
. Detecting 2 (or more) and doing the right thing is left for you.