Listing files bet. two specified dates
Randal Schwartz
merlyn at iwarp.intel.com
Thu Oct 25 10:54:53 AEST 1990
In article <1990Oct24.181321.23205 at dg-rtp.dg.com>, rice at dg-rtp (Brian Rice) writes:
| #!/bin/sh
| # mbetween path bound_1 bound_2
| # Argument 1 is taken to be the root of the directory tree to
| # search. Argument 2 is one bound (in days), and argument
| # 3 is the other bound (in days).
|
| find $1 -mtime -$2 -print > /tmp/mbetween.$$
| find $1 -mtime -$3 -print >> /tmp/mbetween.$$
|
| sort /tmp/mbetween.$$ > /tmp/mbetween2.$$
| uniq -u /tmp/mbetween2.$$
|
| rm -f /tmp/mbetween.$$ /tmp/mbetween2.$$
| exit 0
Long way. Try:
find $1 -mtime -$2 -mtime +$3 -print
with $2 and $3 being in the right order. Much faster, and not prone
to phase errors.
I'd give you a Perl solution, but there's no point unless you want
finer granularity than one day.
Just another UNIX hacker,
--
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel put the 'backward' in 'backward compatible'..."=========/
More information about the Comp.unix.questions
mailing list