Given a directory containing say a few thousand files,
please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents.
e.g. func(�/home/my/files�) where the directory /home/ca31319/files might contain foo.txt, foo.iso, foo.jpeg, bar.txt, bar.doc, baz.csv, baz.ppt etc. and say the file foo.txt is the same as bar.doc and foo.iso is the same as baz.csv and baz.ppt then the output would be:
for i in TEST/*;
do
for a in TEST/*;
do
if [[ $i == $a ]];then
echo "============"
else
comp=`comm -3 $i $a`;
if [[ $comp != "" ]];then
echo "=============="
else
echo "Matches the $i and $a"
fi
fi
done
done
Another route would be to run the sum command on everything in the directory and redirect the output through sort. If the output of sum is the same for a pair (trio, etc.) of files, they should be identical.