[alt.sources.d] TIMESTAMP: a useful file filter by last modified time

amos@taux01.nsc.com (Amos Shapir) (07/02/90)

In article <926@limbo.Intuitive.Com> taylor@limbo.Intuitive.Com (Dave Taylor) writes:
>.SH NOTES
>This command checks the last modified time of the files, not
>the created or last accessed times.  It's possible that we've
>choosen the wrong option in this case.

That's easy to fix: add flags -a for access time, -c for change time.

While we're at it, I find -r confusing - I think -n (for "newer") is
more appropriate.  Even better would be adopting the syntax of 'find'
e.g. +m 30 adds 30 minutes, -h 2 subtracts 2 hours.

Another useful change is to have timestamp read the list of files from
stdin, rather than argv; that way it is not going to be limited by
the size of the args list (usually about 5k), does not require fancy
magic filename matching patterns, and also enables things like
	find dir -options -print | timestamp 

-- 
	Amos Shapir		amos@taux01.nsc.com, amos@nsc.nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522408  TWX: 33691, fax: +972-52-558322 GEO: 34 48 E / 32 10 N

darcy@druid.uucp (D'Arcy J.M. Cain) (07/03/90)

In various articles discussing TIMESTAMP
> [...]

I needed something to operate on files based on the time stamp with better
granularity than find as well.  My approach was to write a program which
simply lists the files on the command line with their age in seconds.  I
can then use standard shell tools to manipulate them.  For example, the
following code lets me delay batching ihave/sendme in C News by 24 hours:

if [ -r $NEWSARTS/holding/* ]
then
	for i in `age $NEWSARTS/holding/* | awk '{if ($2 >86400) print $1}'`
	do
		cat $i | rnews && rm -f $i
	done
fi

I never posted the code because it is so trivial but if any one wants it
let me know.  I will email or post depending on the response.

-- 
D'Arcy J.M. Cain (darcy@druid)     |   Government:
D'Arcy Cain Consulting             |   Organized crime with an attitude
West Hill, Ontario, Canada         |
(416) 281-6094                     |