Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site hammer.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!tektronix!orca!hammer!dce From: dce@hammer.UUCP (David Elliott) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: Re: Patch to find(1) to find large files. Message-ID: <1315@hammer.UUCP> Date: Fri, 7-Jun-85 13:48:53 EDT Article-I.D.: hammer.1315 Posted: Fri Jun 7 13:48:53 1985 Date-Received: Sun, 9-Jun-85 03:34:35 EDT References: <1842@ukma.UUCP> <663@lsuc.UUCP> Reply-To: dce@hammer.UUCP (David Elliott) Organization: Tektronix, Wilsonville OR Lines: 64 Xref: watmath net.bugs.4bsd:1549 net.unix-wizards:13460 Summary: In article <663@lsuc.UUCP> dave@lsuc.UUCP (David Sherman) writes: >Foo, grumble and feh! find(1) already has a "-size" option. >If you want to compare size against another file, it's >trivial to write a one-line awk script which feeds the right >information to find(1). > >Dave Sherman >The Law Society of Upper Canada >Toronto >-- >{ ihnp4!utzoo pesnta utcs hcr decvax!utcsri } !lsuc!dave Put your money where your mouth is, Dave. The above note would imply that you can write an awk script that would generate a find command that looks something like this: find dir \( -size n -o -size n+1 -o -size n+2 ... \) How big can a file get? Now, take the following predicates: -size is to -bigger as -mtime is to -newer Your statement would imply that -newer can be replaced by an awk script to generate information for -mtime. Wrong! The missing quality here is granularity. If you read the manual page for find, you will see that -mtime is measured in days, whereas -newer is a true relative comparison. The -size primary is measured in blocks, whereas -bigger is again a true relative comparison. In other words, -bigger will find that a 4-byte file is bigger than a 3-byte file, whereas -size can not be so granular. Now, I agree that you could write -bigger as something like: find dir -print | print_if_bigger_than file (where 'print_if_bigger_than' is a program that prints the names of the files that are bigger), but this is very slow (eats machines for lunch and process slots for dinner) and doesn't give half of the capabilities that -bigger does. My only criticism of the -bigger modification is that it would be nice if its usage was: -bigger file (same as now) -bigger number where the latter would allow an exact number, and possibly K (*1024) and M (*(1024*1024)) as suffixes. Of course, THIS feature is mostly carried out by the -size option (though -size still isn't as granular). What we really need is a "find compiler". Do you run find on your machine every night? Do you know what it has to go through just to find out if a file is three days old and smaller than 10 blocks or owned by `fred' or setuid root? This can really chew up the ol' CPU cycles. David Elliott tektronix!tekecs!dce