This is an intriguing problem, and a common one at that. Basically we want to know if two files differ by size with the same names in two directories (or if files exist in one directory but not the other). So in essence we have a compound key = filename+filesize. This is a perfect job for
uniq as long as we can build a good key.
So we generate two outfiles with the filenames and sizes. Take a long ls, discard the first line (total) and awk the 5th (size) and last (filename) columns:
ls -l $DirA | awk '{print $NF, $5}' | tail +2 > /tmp/ls.a
ls -l $DirB | awk '{print $NF, $5}' | tail +2 > /tmp/ls.b
Then we sort and count the number of "key" lines, then filter those which are unique:
sort ls.a ls.b | uniq -c | awk '($1 == 1)'
1 bad.jpg 384
1 fred.jpg 19580
1 fred.jpg 384
So this spits out files that only exist on one side or files that aren't the same size. By grepping these in both tmp files we learn which is A versus B side.
Make sure you remove the tmp files when you're done.
-Phrazz
P.S.: For two boxes that don't share a drive mount, use SSH and $PWD if the paths are the same. If not, there's a bit more trickery involved.