Subject: bug#49428: RFE: for --time have option to only include contents, not dir itself.

From: L A Walsh <[email-masked]>
Date: Mon, 05 Jul 2021 23:56:37 -0700

First stab at a script is really slow...

find dirs, then find all files in the dir:

There's gotta be a faster way...ug!

lastt=1
shopt -s lastpipe

find "$1" -depth -type d |
  while read dr;do
    t=$(find "$dr" -xdev -maxdepth 1 -mindepth 1 ! -name . -a ! -name .. 
-printf "%T@\n" |
        cut -d. -f1|sort -rn|head -1)
    if [[ ! $t ]]; then
      t=$lastt
    fi
    if [[ ! $t ]]; then
      echo "dir=$dr"; exit 1; fi
    #echo "touch -d \"@$t\" \"$dr\""
    touch -d "@$t" "$dr"
    lastt=$t
  done