home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / libs / lib_coll.lha / FRQLIB.LZH / Find.LZH / find.doc next >
Encoding:
Text File  |  1991-12-11  |  8.2 KB  |  211 lines

  1.  
  2. FIND, Copyright ⌐ 1989, by Larry Phillips.
  3.  
  4. This program may be freely distributed, in its entirety only,
  5. including updatedb, find, and find.doc.  No chage may be made for
  6. this program beyond a reasonable media charge. It may be distributed
  7. on any public or private BBS or telecommunication service, provided
  8. there are no extra charges for downloading, beyond normal connect
  9. time fees.
  10.  
  11. If you use find, and like it, if it saves you time, or if you have
  12. comments, criticisms or a wish list, please send me a postcard from
  13. where you live. Consider the cost of the postcard and stamp a
  14. shareware fee. If I could include the card and stamp in the
  15. distribution, I would.
  16.  
  17. Send to:
  18.  
  19.     Larry Phillips
  20.     3575 E. 28th Ave.
  21.     Vancouver, BC, Canada
  22.     V5R 1T4
  23.  
  24. -------------------------------------------------------------
  25.  
  26. UPDATEDB:  creates the files used by find
  27. ---------
  28.  
  29.   Updatedb will create a file called 'find.codes' in a directory
  30. called 'FindDB:'.  It will take a while, so don't panic (it takes
  31. about 4 1/2 minutes on my setup, but the time taken will depend
  32. entirely on how many directories and files you are catalogging).  The
  33. file created will only match the actual contents of your partitions
  34. until you save, delete, or move files around, but it is a simple
  35. matter to run updatedb once a day (more or less, depending on your
  36. disk activity, and how long you can remember the changes you make on
  37. your disks).
  38.  
  39. Syntax: updatedb [ [-v] dhn: dhn: ...]
  40.  
  41.    dhn:  device name.
  42.  
  43.     -v:  verbose mode. This is a debuggin feature for updatedb, in
  44.          case you have a problem with a partition or filename. It
  45.          will show you which directory it was working on when it
  46.          failed. The directory names are sent to the screen,
  47.          delimited with vertical bars ('|'), in a different colour.
  48.          The -v option is used only when entering the partition names
  49.          on a command line.
  50.  
  51. Examples:  updatedb            ; take arguments from FindDB:find.config
  52.            updatedb dh0: dh1:  ; catalog dh0: and dh1:
  53.            updatedb -v dh1:    ; catalog dh1:, verbose.
  54.  
  55. If you specify partitions on the command line, they will be used to
  56. generate the find.codes file.  If you don't specify partitions,
  57. updatedb will look for a file in your 'FindDB:' directory called
  58. 'find.config'.  This file should have _only_ one line in it,
  59. consisting of the partitions you want to include in the catalog,
  60. separated by spaces.  In either case, the last partition named in
  61. 'find.config' or on the command line will be the first one processed,
  62. so you should put them in order of least likely to most likely to be
  63. searched.
  64.  
  65. updatedb may be stopped by typing a CTRL C. It will stop after
  66. processing the directory it is working on.
  67.  
  68.  
  69. find.codes:  This is a straightforward file, consisting of directory
  70. names and file names, separated by NULL bytes.  (hex 00).  Directory
  71. names will always end with a colon (':') or a slash ('/').  The order
  72. is as follows:
  73.  
  74. dirname/ NULL filename NULL filename NULL dirname/ NULL filename NULL ...
  75.  
  76.             =================================
  77.  
  78. FIND:  find files and directories on hard disk
  79. -----  
  80.  
  81.   Find  uses a database file called 'find.codes', to quickly find any
  82.   directory or file.  These two files are created by the companion
  83.   program 'updatedb'.
  84.  
  85.   Output from the program may be halted at any time by pressing
  86.   CTRL C. I debated a long time on where to check for the CTRL C, for
  87.   speed considerations,and finally decided to check only when a match
  88.   was detected, and right after the directory search.  This means
  89.   that the directory will be completely searched if there are no
  90.   matches. It ends pretty quickly anyway (see comments on speed
  91.   below).
  92.  
  93. Syntax: find [-e] string
  94.  
  95.   string :  the string to match.  Without the '-e' argument, the
  96.             string need only be contained in the directory or file
  97.             entry.  For example, the string 'game' will match
  98.             'game', 'games', or 'endgames'.  See '-e' below for
  99.             exact matches.
  100.  
  101.       -e :  Optional, [E]xact.  Matches directories and filenames
  102.             only if the string argument matches exactly.  For
  103.             example, the argument 'game' will not match a directory
  104.             or file named 'games'
  105.  
  106.       -d :  Only match on directory names.
  107.  
  108.       -f :  Only match on file names
  109.  
  110.       -v :  Verbose. Show a header for directories and one for files.
  111.  
  112.    The above flags can be combined in any way. The only one that doesn't
  113.    make sense if using -f and d ( -fd ) at the same time. Since the
  114.    function of these flags is exclusionary in nature, you are excluding
  115.    files and directories.
  116.  
  117.             =================================
  118.  
  119. Setting it up
  120. -------------
  121.  
  122.   Find and updatedb contain a few 'hardwired' assumptions.
  123.  
  124.   The first assumption:  I have an assigned directory called 'FindDB:'
  125. You can set up a directory like this, and make the assignment, or if
  126. you wish to have your find files elsewhere, use a file zapper to
  127. change the path/filename in both programs.  I welcome suggestions on
  128. how best to set up the configurability.
  129.  
  130.   The second assumption is only in updatedb, and that is that if no
  131. command line arguments are given, it looks for them in
  132. 'FindDB:find.config'
  133.  
  134.             =================================
  135.  
  136. Everyday usage:
  137. ---------------
  138.  
  139.   I usually run updatedb once per day, either before going to bed or
  140. before going to work.  It would be a good candidate for putting in a
  141. crontab to run at some time you will not be using the machine.
  142.  
  143.   Find is extremely fast, especially when compared with searching a
  144. disk with DIR or LIST.  If I invoke it with a string that I know will
  145. not be found (eliminating screen output time), it will do a complete
  146. search in between 2 and 7 seconds, depending on the length of the
  147. pattern searched for (longer patterns take less time).  Before you
  148. groan and tell me that isn't fast, let me tell you about my find
  149. files and disk partitions...
  150.  
  151. My FindDB:find.codes is 133351 bytes long, consisting of 1174
  152. directory entries and over 10,000 file entries
  153.  
  154.   If you are anything like me, you forget where things are, and
  155. waste a lot of time looking for them.  On my current setup, it would
  156. take me over 5 minutes to do a 'dir all' of all partitions, and more
  157. time still to search the output for the file I want.  The disk space
  158. overhead in having the find files is quite small.
  159.  
  160.   Now for 2.0, the new output format of find allows you to do some very
  161. things. The 2.0 AmigaShell has what is known as 'backtick' capability.
  162. This allows you to use the backtick character (the character below the
  163. tilde, to the left of the '1' key), to surround a command, and to use the
  164. results as input to the command itself, just as if you had typed the
  165. arguments in. Here ara couple of examples. First, using standard Amigados
  166. commands...
  167.  
  168. First, the search command..
  169.  
  170.     search #?.(c|h) MyFunction nonum quiet
  171.  
  172. The above command will show you the names of all files in the current
  173. directory, ending in .c or .h, that contain the string 'myfunc'. Now you
  174. can combine it with another command, such as list...
  175.  
  176.     list `search #?.(c|h) MyFunction nonum quiet`
  177.  
  178. In this command, the files are searched, just as in the search used alone,
  179. but the results are sent to 'list' to be used as command arguments, and all
  180. the files containing 'myfunc' will be listed.
  181.  
  182. Find is one of the handiest programs to use in this manner. If you always
  183. call temporary files by the same name, such as 'junk' or 'foo' or 'tmp',
  184. and if you know that you do not have any files containing worthwhile info
  185. that are called by those names, you can get rid of them all in one command.
  186.  
  187.     delete `find -fe junk`
  188.  
  189. Another possibility... you have a number of files scattered around the disk
  190. that are really the same file, but you only ant to keep the most recent one.
  191. Rather than looking all over and hoping you don't miss any, you can use find.
  192. Beter, you can use find in a backtick to list them, allowing you to see the
  193. date...
  194.  
  195.    list `find -fe macros.asm`
  196.  
  197. Perhaps you want to edit the files. Assume you are using CEDPro...
  198.  
  199.    ed `find -fe macros.asm`
  200.  
  201.   The possibilities are endless. 
  202.  
  203.  
  204.             =================================
  205.  
  206. Enjoy!
  207.  
  208. Larry Phillips: CIS -  76703,4322
  209.                 Usenet - lphillips@lpami.wimsey.bc.ca
  210.                       or uunet!van-bc!lpami!lphillips
  211.