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





Reply via email to