#! /bin/bash -u
# Last edited on 2026-09-11 07:21:04 by stolfi

# Lists files in a given folder {src} that are not 
# links but have the same name as files in another folder {dst}.

src="$1"; shift
dst="$1"; shift

files=( \
  $( cd ${src} && ls \
      | egrep -v -e '[~]|JUNK|SAVE|tests|__pycache__|Makefile' \
      | egrep -v -e '[.]old|junk|[.]frq' \
  ) \
)

for f in "${files[@]}"; do
  if [[ ( -s ${src}/$f ) && ( -s ${dst}/$f ) && ( ! ( -L ${src}/$f ) ) ]]; then
    echo "** $f" 1>&2
    ls -ld ${src}/$f ${dst}/$f
  fi
done

