home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / DIR / SNIF134.ZIP / SNIF.DOC < prev    next >
Encoding:
Text File  |  1992-03-16  |  18.9 KB  |  457 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                       ---------------------------------
  9.                        SNiF - The ultimate file-finder
  10.                                  Version 1.34
  11.                                Copyright (c)1992
  12.                            Written by Carl Declerck
  13.                       ----------------------------------
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. Introduction
  25. ------------
  26.  
  27. SNiF is a program that allows you to find files across one or more harddisks
  28. (floppies). It is operated from the DOS command line and offers many options
  29. which may affect the 'sniffing' (searching) of files.
  30.  
  31. SNiF uses a method called Dynamic Parameter Parsing (DPP) to give the user
  32. optimum sniffing performance. This means that options may be dynamically set
  33. from command-parameter to command-parameter, thus affecting only those actual
  34. parameters in between!
  35.  
  36. You will find that SNiF adapts itself automagically to your personal knowledge
  37. and experience in using the program. SNiF is as easy to operate as the DOS
  38. "dir" command. On the other hand, it is so powerful and versatile that a BBS
  39. sysop can do his complete daily maintenance under SNiF's control and
  40. supervision. Its uses and possibilities are unlimited!
  41.  
  42.  
  43. Running SNiF
  44. ------------
  45.  
  46. To start SNiF, you just type its name at the DOS prompt. When no parameters or
  47. options are given, SNiF will display some cryptic information on the options
  48. provided and their default values.
  49. The parameters which can be passed to SNiF are file-masks and options. File-
  50. masks are strings such as: *.BBS, BIMOD???.DOC, WIN.*, etc... any valid DOS
  51. wildcarded name. Options are strings such as: +d, -f, "+xdir &p&m", etc...
  52.  
  53.  
  54. Options provided
  55. ----------------
  56.  
  57.     +aHSRA, -a
  58.  
  59.     Allows you to specify an attribute mask. Only files that have these attrs
  60.     will be sniffed. Option -a disables attribute sniffing, it has the same
  61.     effect as +aHSRA (ie. all attrs on). Valid attribute-identifiers are:
  62.     H (Hidden), S (System), R (Read-only) and A (Archive). Any of these
  63.     identifiers may be combined to make up the sniffing attribute mask. The
  64.     order is of no importance.
  65.     The default is -a.
  66.  
  67.     +bSTRING, -b
  68.  
  69.     This option is only useful when using a logfile (see further). It allows
  70.     you to put in a commentline with the value of STRING. Note that when the
  71.     +b option is set, all logged pathnames of files sniffed will be indented
  72.     by 3 spaces, giving a neater layout. Option -b disables this indentation.
  73.     Note that when STRING equals "INFO", additional file-info will be logged
  74.     with each pathname.
  75.     The default is -b.
  76.  
  77.     +c, +c1, -c
  78.  
  79.     Tells SNiF to ask for confirmations before executing a given command, or
  80.     not. When just +c is used, SNiF will ask the user whether it should 
  81.     execute the specified +x command. Alternatively, when +c1 is used, SNiF
  82.     displays the currently found file and prompts for a command to be entered.
  83.     This command is subject to substitution just like the +xSTRING commands.
  84.     The default is -c.
  85.  
  86.     +d, -d
  87.  
  88.     This option allows you to tell SNiF whether it should display the full
  89.     pathname of any file that matches the given file-mask(s), or not.
  90.     The default is +d.
  91.  
  92.     +e, -e
  93.  
  94.     Enables or disables the escape key whilst sniffing.
  95.     The default is +e.
  96.  
  97.     +f, +f1, -f
  98.  
  99.     This option allows you to tell SNiF whether it should stop searching through
  100.     the directories when a file matching the specified file-mask(s) is found.
  101.     The +f option tells SNiF it should skip to the next directory when a
  102.     matching file is found, the +f1 option tells SNiF it should stop sniffing
  103.     immediately. The -f option tells SNiF it should just continue sniffing when
  104.     matching files are found.
  105.     The default is -f.
  106.  
  107.     +gSTRING, -g
  108.  
  109.     Allows you to snif for files that contain the STRING sequence of
  110.     characters. This option is cumulative, this means you can specify multiple
  111.     search-strings with multiple instances of +g.
  112.     By default, searching for a STRING is case-insensitive. To make it case-
  113.     sensitive, you precede STRING by a '!'. It is also possible to insert
  114.     non-keyboard characters by giving their ASCII value in 2-digit hex-from,
  115.     preceded by a backslash (ie. \XX). To escape the backslash itself, you
  116.     simply use '\\'.
  117.     Option -g clears ALL search-strings.
  118.     The default is -g.
  119.  
  120.     +iSTRING, -i
  121.  
  122.     Tells SNiF to take subsequent options from a control file. STRING is the
  123.     name of the control file to be used, it defaults to SNIF.CTL. When a +i
  124.     option is issued SNiF will open the control file and use its contents as
  125.     if they were passed as parameters on the command-line. When SNiF reaches
  126.     the end of the control file, it just continues taking its parameters from
  127.     the real command-line! This option is particularly useful for passing on
  128.     variable lists of filemasks that should be sniffed for. The -i option may
  129.     be used inside a control file to stop SNiF taking options from it.
  130.     The default is -i.
  131.  
  132.     +kSTRING, -k
  133.  
  134.     This one allows you to specify a 'C-like' format-string for the logfile
  135.     output. For each file sniffed this string will be logged, subject to the
  136.     following substitutions:
  137.  
  138.      &f  full pathname (incl. filename) of the file sniffed
  139.      &p  pathname only of file sniffed
  140.      &n  filename only of file sniffed
  141.      &m  currently active filemask
  142.      &t  sniffed file's creation time
  143.      &d  sniffed file's creation date
  144.      &a  sniffed file's attributes
  145.      &s  sniffed file's size in bytes
  146.  
  147.     It is also allowed to include hex-entries (\XX) in the format-string, like-
  148.     wise to the +g option.
  149.     The +k option is one of the more advanced features of SNiF... so for normal,
  150.     standard logfile-info one might rather use the simpler +bINFO (or -bINFO)
  151.     option! Option -k disables the format-string.
  152.     The default is -k.
  153.  
  154.     +lSTRING, -l
  155.  
  156.     Tells SNiF whether it should log the full pathname of each matching file,
  157.     or not. STRING is the name of the logfile to be used, if it doesn't exist,
  158.     it is created, if it exists already, it is appended to. When the +l option
  159.     is used with STRING omitted, STRING defaults to SNIF.LOG. However, if a
  160.     +lSTRING option has been turned off with -l, and is later re-activited with
  161.     just +l, the old value of STRING will be re-used!
  162.     The default is -l.
  163.  
  164.     +m, +m1, +m2, -m
  165.  
  166.     This option is an _extremely_ powerful one; it allows you to build advanced
  167.     exceptions using any criteria that SNiF supports (ie. not only filemasks,
  168.     as +n option). Advanced exceptions are built just as you would build a set
  169.     of criteria for normal sniffing, ie. you just specify the criteria which
  170.     make up the advanced exception using the normal options...
  171.     To start building advanced exceptions, issue the +m command. Any criteria
  172.     or filemasks following this +m will be added to the advanced exception
  173.     list.
  174.     When the advanced exception list is built, and you want to activate it,
  175.     issue the +m1 command and subsequently specify the criteria and filemasks
  176.     you wish to snif for.
  177.     For example: we wish to snif all files on the current drive, except all
  178.     hidden .SYS files. This could be done with something like:
  179.  
  180.       SNiF +m +aH *.sys +m1 -a *.*
  181.  
  182.     We first turn on advanced exception building with +m, then specify the
  183.     criterion for hidden-attribute sniffing and the *.sys filemask. Note that
  184.     after having turned off building of advanced exceptions with +m1 (thus also
  185.     activating it!), we still need to specify -a because we want to snif every
  186.     file on the drive, not only the hidden ones! It is important to note that a
  187.     +m1 instance does NOT turn off any criteria activated for advanced
  188.     exceptions, we must do so separately!
  189.     The +m2 option is similar to +m1, except that it also sets the Hidden
  190.     attribute of all files in the advanced exception list. This may be useful
  191.     when calling programs/commands that are passed wildcard parameters.
  192.     When SNiF terminates or -m is issued, all +m2 Hidden files are restored to
  193.     their original attribute.
  194.     To disable advanced exceptions, -m must be issued.
  195.     The default is -m.
  196.  
  197.     +nMASK, -n
  198.  
  199.     This option is a power-option of SNiF! It allows you to make exceptions in
  200.     the files which should be sniffed for. MASK must be a valid wildcard. Any
  201.     files that match the MASK wildcard will be ignored by SNiF. The +n options
  202.     may be repeated to specify multiple MASKs. Note that MASKs should NOT
  203.     include paths! If you want to have exceptions on paths as well, you should
  204.     use advanced exceptions (option +m).
  205.     The -n option turns ALL exceptions off.
  206.     The default is -n.
  207.  
  208.     +o, -o
  209.  
  210.     Tells SNiF whether to use logical ORs or ANDs when dealing with each
  211.     criterion list. Option +o will cause all criteria in the following
  212.     criterion-instances to be OR'ed to make up the end-result for that
  213.     criterion list (the OR is implicit). The -o option causes all criteria to
  214.     be AND'ed. For example:
  215.  
  216.       SNiF +o +gbilbo +gbaggins *.txt
  217.  
  218.     will show all .TXT files containing the case-insensitive strings "Bilbo"
  219.     OR "Baggins". Whereas
  220.  
  221.       SNiF -o +gbilbo +gbaggins *.txt
  222.  
  223.     would show only those .TXT files containing both "Bilbo" AND "Baggins".
  224.     The default is +o.
  225.  
  226.     +r, -r
  227.  
  228.     Tells SNiF whether it should snif directories recursively or not.
  229.     The default is +r.
  230.  
  231.     +s, -s
  232.  
  233.     The +s option tells SNiF to display some statistics on the actions it per-
  234.     formed up 'till now. The -s option makes SNiF forget about all previously
  235.     performed actions.
  236.     The default is -s.
  237.  
  238.     +tSTRING, -t
  239.  
  240.     Allows you to specify an indefinite number of file creation-time criteria.
  241.     Like +n, multiple criteria may be specified with multiple instances of +t.
  242.     SNiF can handle two types of time criteria: absolute and relative ones.
  243.     Absolute criteria are of the form: Thh:mm:ss where T is either E (equal
  244.     to), B (before) or A (after), and hh:mm:ss is a time in
  245.     hours:minutes:seconds, two digits per time-element MUST be given. So,
  246.     option +tA20:12:16 means only files created after 20:12:16 will be sniffed.
  247.     Relative criteria are of the form: Tnnnnn where T is either X (exactly),
  248.     O (older than) or Y (younger than), and nnnnn is a number of minutes in
  249.     decimal. So +tX45 means only snif files that are exactly 45 mins old.
  250.     Option -t clears ALL stacked time-criteria.
  251.     The default is -t.
  252.  
  253.     +uSTRING, -u
  254.  
  255.     Allows you to specify an indefinite number of file creation-date criteria.
  256.     Like +n, multiple criteria may be specified with multiple instances of +u.
  257.     SNiF can handle two types of date criteria: absolute and relative ones.
  258.     Absolute criteria are of the form: Ddd/mm/yy where D is either E (equal
  259.     to), B (before) or A (after), and dd/mm/yy is a date as day/month/year, two
  260.     digits per date-element MUST be given. So, option +uB14/09/90 means only
  261.     files created before 14th of september 1990 will be sniffed.
  262.     Relative criteria are of the form: Dnnnn where D is either X (exactly),
  263.     O (older than) or Y (younger than), and nnnn is a number of days in
  264.     decimal. So +uO5 means only snif files that are (more than) 5 days old.
  265.     SNiF also supports the American date-format, month-day-year. To use it
  266.     instead of European format, dashes must be used to separate the date-
  267.     elements. Ie: mm-dd-yy.
  268.     Option -u clears ALL stacked date-criteria.
  269.     The default is -u.
  270.  
  271.     +wXY, -w
  272.  
  273.     This option tells SNiF whether it should snif the whole system, or just the
  274.     specified paths. If just +w is used, SNiF will search the whole currently
  275.     selected drive. However, you can set the starting and ending drive
  276.     (including floppies) by adding them to the +w option: The first letter
  277.     corresponds to the first drive in the 'snif-range', the second letter
  278.     corresponds to the last drive. If only a single letter is specified, it
  279.     will correspond to the first drive. A special drive-letter is supported
  280.     through the '@' character, it denotes the current drive.
  281.     The default is +w@@. Any paths preceding filemasks override this default.
  282.  
  283.     +xSTRING, -x
  284.  
  285.     This is another power-option of SNiF: it allows you to tell it which
  286.     DOS commands/programs it should execute when a file matches the given
  287.     file-mask. Multiple commands/programs may be specified using multiple
  288.     instances of +x. The commands/programs will be executed in the order they
  289.     are given at the command-line (or in the control-file).
  290.     Because DOS uses the SPACE character to separate its command-line into
  291.     parameters, it may be necessary to surround the +x option with
  292.     double-quotes " or square-brackets [ and ] when this contains any spaces.
  293.     This will cause DOS to see it as a single parameter. The following
  294.     character-sequences will be replaced by runtime-values when they are found
  295.     in STRING and when a matching file is found:
  296.  
  297.      &f  replaced by the full pathname of a matching file
  298.      &n  replaced by the filename (w/o extension) of a matching file
  299.      &x  replaced by the extension of a matching file's filename
  300.      &p  replaced by the path which a matching file resides in
  301.      &m  replaced by the currently active file-mask
  302.  
  303.     The -x option clears ALL stacked commands/programs.
  304.     The default is -x.
  305.  
  306.     +zSTRING, -z
  307.  
  308.     This option allows you to set a filesize criterion. An unlimited number of
  309.     filesize criteria may be set (memory-permitting, of course) by specifying
  310.     multiple instances of the +z option (analogous to +n option). Only files
  311.     whose filesize conforms to at least one of the criteria are sniffed.
  312.     The value of STRING must be of the form "Onnnnnnn", where O is either
  313.     E (equal to), L (less than) or G (greater than), and where nnnnnnn is the
  314.     number of bytes to compare the filesize with (decimal).
  315.     The -z option clears ALL stacked filesize criteria.
  316.     The default is -z.
  317.  
  318.  
  319. Using SNiF
  320. ----------
  321.  
  322. When using SNiF, the user should know that the parameters are parsed
  323. dynamically, this means that all the various options can be turned on and off
  324. on the same command-line!
  325.  
  326. For example, "SNiF +f1 *.exe -f *.com" will only snif for the first .EXE file
  327. to be found, but will snif for all .COM files.
  328.  
  329. SNiF will exit with errorlevel 1 when at least one file was sniffed, otherwise
  330. it'll exit with errorlevel 0.
  331.  
  332.  
  333. Using control files to drive SNiF
  334. ---------------------------------
  335.  
  336. With the +i option, you can instruct SNiF to take its options/parameters from
  337. a specified control file.
  338. Such a control file is plain vanilla ASCII text and can be created with your
  339. favourite text-editor. Lines in these control files may contain:
  340.  
  341.   - options, as at the command-line (ONE option per line!!!)
  342.   - filemasks (preceded by paths) (ONE filemask per line!!!)
  343.   - comments, preceded by a semi-colon ';'
  344.   - nothing, ie: blank lines
  345.  
  346. Note that it is no longer necessary to use quotes " or square brackets [ and ]
  347. to delimit strings inside control files. This restriction only applies to the
  348. command-line and the SNIF environment variable (see below).
  349.  
  350. When the end of a control file is reached (when all options and parameters in
  351. it have been parsed/executed), SNiF will again continue to take options from
  352. the command-line.
  353.  
  354.  
  355. The SNiF environment variable
  356. -----------------------------
  357.  
  358. You can set up a DOS-environment variable called SNIF which will be parsed in
  359. the same way as the command-line or control files when SNiF starts up.
  360. This allows you to customize SNiF to your particular system needs. For example,
  361. you may want to set a different default sniffing range with +w, or change the
  362. default logfile-format using +k. Or you could even use +i to run 'default'
  363. control files. Anything is allowed!
  364.  
  365.  
  366. Some examples
  367. -------------
  368.  
  369. a) SNiF -d +f +wBF "+xdel &p&m" *.tmp
  370.  
  371.    Deletes all .TMP files on drives B: through F:.
  372.  
  373. b) SNiF e:\windows\*.ini -r e:\*.com
  374.  
  375.    Shows all .INI files on drive E:, starting from directory \WINDOWS.
  376.    Shows all .COM files in the root (only!) of drive E:.
  377.  
  378. c) SNiF -d "+xcopy &f c:\backup\&n.bak" d:\tcpp\*.c +s
  379.  
  380.    Copies all .C files starting from drive D:'s \TCPP directory to drive C:'s
  381.    \BACKUP directory, but with extension .BAK.
  382.    Gives statistics on all performed copies.
  383.  
  384. d) SNiF -d +w +nnot_this.txt "+xtype &f" *.txt
  385.  
  386.    Will type every .TXT file to be found on your system to the screen, except
  387.    the NOT_THIS.TXT file!
  388.  
  389. e) SNiF -d +wE +lgiflog.txt "+bList of GIF files:" *.gif -b +i
  390.  
  391.    Makes a logfile called GIFLOG.TXT of all GIF files, starting from drive E:,
  392.    with logfile comment "List of GIF files:".
  393.    Afterwards, it'll take subsequent options from SNIF.CTL.
  394.  
  395. f) SNiF +n*.lzh +n*.zip +n*.arc -d "+xdel &f" e:\temp\*.*
  396.  
  397.    This will delete all non- .LZH .ZIP .ARC files on drive E:, starting from
  398.    directory \TEMP.
  399.  
  400. g) SNiF +w +aHS *.* -a "+xdel &f" +zE0 *.* +l -x -z +zG1000000 *.*
  401.  
  402.    Lists all Hidden System files, then deletes all 0-length files and
  403.    finally logs all files which are over 1 meg in size.
  404.  
  405. h) SNiF +m +zE0 *.* +m1 -z *.*
  406.  
  407.    Lists all non-0 length files on the current drive.
  408.  
  409.  
  410. Disclaimer
  411. ----------
  412.  
  413. You use SNiF at your own risk! I will not be held responsible for any possible
  414. loss of data or damage, caused to your system through the use of SNiF.
  415. You should be fully aware of the fact that SNiF can perform very powerful, yet
  416. extremely radical tasks! Forgetting to turn off a +xdel option may well be the
  417. cause of many a sleepless night, just to name an example.
  418.  
  419.  
  420. Limitations
  421. -----------
  422.  
  423. SNiF has been written to make the best use of available memory. However, as it
  424. is a kind of program that is expected to be fast, it is limited to 64Kb of
  425. work-space, ie. one data-segment in standard DOS. Therefore most strings used
  426. in SNiF have a limit of 128 or 256 bytes. This should be sufficient for most
  427. tasks you want it to do, but if you get a 'Memory allocation failed' error,
  428. you should write to one of the addresses listed below and I may recompile a
  429. version for a larger memory-model. This larger version will be slower though!
  430.  
  431.  
  432. Comments
  433. --------
  434.  
  435. SNiF is a freeware program, which means you copy and share it freely, as long
  436. as the program-code and this documentation is not modified.
  437. The program and docs were written by Carl Declerck, Copyright (c)1991-1992.
  438.  
  439. Special thanx go to:
  440.  
  441.      Jan Meeremans.    Beta-testing and bug-reports.
  442.      Christophe David. Beta-testing, bug-reports and responsible for many of
  443.                        the great ideas behind SNiF's various features.
  444.  
  445. Any supporting remarks or bug reports may be directed to the addresses listed
  446. below:
  447.  
  448. Snail   : Vrijgeweidestraat 24, 2800 Mechelen, Belgium (Voice: +32-15-432064)
  449.  
  450. Netmail : 2:292/500.21510@fidonet.org
  451.  
  452.  
  453. Hope you enjoy using the program!
  454.  
  455.                                                      The author, Carl Declerck.
  456.  
  457.