I need to find every duplicate filenames in a given dir tree. I dont know, what dir tree user will give as a script argument, so I dont know the directory hierarchy. I tried thi
One "find" command only:
lst=$( find . -type f ) echo "$lst" | rev | cut -f 1 -d/ | rev | sort -f | uniq -i | while read f; do names=$( echo "$lst" | grep -i -- "/$f$" ) n=$( echo "$names" | wc -l ) [ $n -gt 1 ] && echo -e "Duplicates found ($n):\n$names" done