Path: utzoo!attcan!uunet!ogicse!littlei!omepd!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: Listing files bet. two specified dates Message-ID: <1990Oct25.005453.16326@iwarp.intel.com> Date: 25 Oct 90 00:54:53 GMT References: <9220005@hpldsla.sid.hp.com> <2162@sixhub.UUCP> <1990Oct24.181321.23205@dg-rtp.dg.com> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 32 In-Reply-To: rice@dg-rtp.dg.com (Brian Rice) In article <1990Oct24.181321.23205@dg-rtp.dg.com>, rice@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@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel put the 'backward' in 'backward compatible'..."=========/