bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: L A Walsh
Subject: bug#49428: RFE: for --time have option to only include contents, not dir itself.
Date: Mon, 05 Jul 2021 23:56:37 -0700
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

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

[Prev in Thread] Current Thread [Next in Thread]