Listing files bet. two specified dates

Alex Martelli alex at am.sublink.org
Sat Oct 27 18:57:32 AEST 1990


In <1990Oct24.181321.23205 at dg-rtp.dg.com> rice at dg-rtp.dg.com (Brian Rice) writes:
	...
>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.$$

I don't see how this can work as is (to follow this approach, you'd have
to place the sorted outputs of the two find's into two separate files,
then use comm on these files, etc), and anyway this is simpler:

	find $1 -mtime +$2 -mtime -$3 -print

since '+$2' means 'MORE than $2 days ago' just as '-$3' means 'LESS
than $3 days ago'.  Anyway, I agree that the date arithmetic's harder.
-- 

Alex Martelli - (home snailmail:) v. Barontini 27, 40138 Bologna, ITALIA
Email: (work:) staff at cadlab.sublink.org, (home:) alex at am.sublink.org
Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; 



More information about the Comp.unix.questions mailing list