[Gllug] Most Recent File

Peter Grandi pg_gllug at gllug.to.sabi.co.UK
Wed Nov 23 00:44:07 UTC 2005


>>> On Tue, 22 Nov 2005 23:57:10 +0000,
>>> pg_gllug at gllug.for.sabi.co.UK (Peter Grandi) said:

sanelson> [ ... ] A better one would be "since 17.37 last
sanelson> Wednesday when fred logged in and made a number of
sanelson> changes". [ ... ]

pg_gllug> Great are the powers of 'date'(1)! :-)

pg_gllug>   THEN="`date +'%s' -d 'last friday 17:37'`"; NOW="`date +'%s'`"
pg_gllug>   find "$DIR" -mmin "`expr '(' \"$NOW\" - \"$THEN\" ')' / 60`"

Uhhh, I have just remembered that there is another more precise
way (the one above might be 1-2 minutes off), if slightly more
involved; if one has a 'find' with the '-mmin' extensions one
probably also has 'touch' with the '-d' extension:

  STAMP="`tempfile`"; trap "rm -f '$STAMP'" 0
  touch -d 'last friday 17:37' "$STAMP"
  find "$DIR" -newer "$STAMP"
  rm -f "$STAMP"; trap 0

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list