SHAREWARE DISCLAIMER -------------------- No warranty is expressed or implied in the use of this software. The user assumes all risk of its use, misuse, and abuse. The author will make every reasonable attempt to provide bug-free and safe software, but is never under legal obligation to do so. Any part of this disclaimer that may be determined invalid in a court of law will not adversely affect any other part, and the remaining terms will be intact. This program is shareware. It is not free. Lots of hard work and broken pencils are behind this software. For a single user, registration is only $7. This gets you free access to future versions, or we can actually mail you a diskette for $5 each. For corporate users, a site license is available for $49. There is no single-user corporate license, but the site license covers any number of computers belonging to one business entity in a single ZIP CODE (first 5 digits). Exceptions to this license require written permission of the author. As soon as they are available, paid licensees are entitled to a printed copy of the documentation as well, which they are then free to copy and distribute to any licensed user. Using this software or distributing it constitutes your full agreement with all of the above terms. You may later revoke this agreement by destroying all copies of the software and documentation and terminating the use of the software. The agreement is not terminated until elimination of possessed copies is complete and will in no way be retroactive. Distribution of this program as a complete and unaltered program is allowed without any cost to you. PLEASE DO NOT TAMPER WITH UFI IN ANY WAY. THERE IS A BUILT-IN INTEGRITY CHECK THAT WILL FAIL IF YOU ALTER THE PROGRAM. You may charge a reasonable fee to cover cost of the actual distribution, but you may not represent it in any way as a 'license fee' or 'purchase' of this program, nor may you collect any such fee. You may charge for a product that includes UFI so long as the work is not largely based on UFI or largely enhanced by UFI. It may be included as a facility or a part of a large collection of tools. This program is Copyright 1993 Andrologic CMN. All rights reserved. HOW TO ORDER ------------ Simply send the appropriate fee along with return address and type of license desired (mention product name and personal or site license) to the address at the bottom of this file. THE PROGRAM ----------- Now that we got all that nasty legal business out of the way.... UFI, what is it? Universal File Information - a program conceived to replace a myriad of separate utilities. UFI can do all of these things: Direct a copy program to update older versions of files Search for versions of a file newer than the one you have Search for a file/files based on size, attribute, name, location, contents, or date Generate statistical reports for networks Do some kind of batch processing on a wide variety of files, with no memory overhead (environment mode) Just about anything else you can imagine involving file maintenance UFI does these things with the information you find: Format in one of many different predefined formats, including "DOS dir" format Format to a custom format defined at run-time, using the drive letter, path, file name, extension, date, size, and attribute string free-form Include directory information with the filename, or separate it out to appear only once Place output data on screen, in file, in environment, or call a program and use it as part of the command tail, or make a batch file Place execution trace information and error notes in a log file. UFI can take directions from the command-line or from the UFI_PARMS environment string. Recommendation : print this out or redirect it to a file for use with a viewer or editor. Syntax: ufi [ ... ] Note that you may specify multiple wildcards, e.g. *.txt *.doc *.bat FILESPECS --------- You may include as many filespecs as you wish, up to the limit of the command line. You may also give no filespec, which causes *.* to be assumed. OPTIONS INFO ------------ A word about options in UFI: Switches in UFI are pretty flexible. There may be variations in notation within this DOC so I'll attempt to explain all the possible mangulations up front. If you wish to order the command-line handling unit used for this program, contact the author (see the bottom of this file). A switch is preceeded either with the - or the / character. This is to be friendly to the occasional unixhead that gets stranded in some uncivilised hole where they only have peecees. Switches take "parameters", either numeric or string or in some cases both. When a switch takes a number, the number should immediately follow the switch letter. Example /T2, not /T 2. Negative numbers are sometimes used, in which case you just do the same thing: /Z-50000. Numbers are internally treated as 32 bit signed integers. Strings are separated from the switch by either a = or :. Additionally, you may surround a string in a "" pair, in which case the = or : is no longer required, but still may be included. Lastly, a closing quote at the end of a command line may be omitted, and is assumed to be located after the last non-blank character on the line. /P=D:, /P:D:, -P="D:", -P"D:", and -P"D: are all acceptable. What's more, you can combine options on one switch character up to the point where you have a string parm. For example, -s4k-3p=d: is equivalent to /s4 /k-3 /p="d:" Any text following the quotation marks of a string parm will be interpreted as the next parameter, generally a non-switch parameter. For example, you could do this: -s4k-3p"d:"*.* This would be interpreted the same as /s4 /k-3 /p=d: *.* OR, for DOS-lovers, *.* /s4 /k-3 /p=d: Switches can be made to be case sensitive or not also on an individual basis, but for the moment UFI itself is not case sensitive. LITERALS -------- In most cases, literals in UFI are pretty straightforward. A string containing no spaces may simply represent itself. For example, if you want to use the p option with c:\tools, you can just add: -p=c:\tools The same is true of the search parm c. You can just type -c=text. Now, if the text you want to search for contains spaces, just type -c="text with spaces". Ah, but you ask, what if the text I'm searching for contains double- quotes. Now you need to type this: -c="text with ""double quotes""" Each pair of double quotes inside a literal is replaced with one double quote in your search argument. The argument above becomes text with "double quotes". Tildes are used in UFI for some of the substitution strings. If you want a real tilde to appear in the string, just insert two. In fact, for UFI it is a general rule that any special character is escaped by two immediately adjacent occurrances of that character. In the case of ~f, you would put ~f~f to actually get ~f to appear in the output. OPTIONS ------- /* - perform program integrity check. This is a rudimentary self-test that stands a reasonable chance of thwarting a virus attack. PLEASE NOTE THAT ANY SORT OF TAMPERING WITH THE EXE FILE WILL CAUSE THIS TEST TO FAIL. YES, EVEN THAT. /P: - startup path Specify this switch to allow specification of a starting search directory when UFI is used in the tree search modes 1 and 2. The default is the current drive and directory. Please note that there is a difference between /P=D: and /P=D:\. (/P=D: is equivalent to /P=D:.\, not the root) /E: - place filename of match in environment Specify this option to put the (first | next | last) hit in a specified environment variable. The environment variable will be set based on the setting of the /O option. Default is for no environment variable set. If you specify /E without a string, the variable _UFI_ is used. Note: in cases where you are running a shell it is a good idea to preset an environment variable to some long string in order to provide enough space. DOS normally provides very little spare room in a secondary command shell's environment /R={str} - recursion display This option turns on display of the current search directory during a tree search. This is especially handy during a volume or multi- volume search where the output goes to a file. Optionally you can specify a string to be dumped to standard out on each directory containing hits, giving some sort of delimeter in the file. Each occurrance of "~" is replaced by the directory name. /On - output format This option switch controls the format of the result set. A numeric value following the O determines the set type: 0 - full pathname reported 1 - file name only reported (default) 2 - directory only reported 3 - drive letter only reported 4 - date/time reported 5 - date reported 6 - size reported 7 - DOS "dir" format 8 - file name no extension reported 9 - extension no filename reported 10 - file name, no extension, but with directory 11 - file name, ext, directory, but no drive letter 12 - relative pathname OR, leave out the number and use the Custom option: /O="string" ~d is replaced with the drive letter ~p - pathname ~f - file name ~e - file extension ~z - file size ~c - file date (c is for calendar) ~t - file time ~a - file attribute string 1 is the default setting. /Sn - stop on [n: 0 first, 1 next (must use same env var), 2 last match Tells UFI when to stop. The S is followed by a numeric value: 0 - stop on first hit 1 - stop on "next" hit. You must use the environment option with this one, and you must use the same variable. This is actually a feature, not a restriction, as you can have several iterations going on just by using different variables. 2 - stop on last match. This is the default setting, and will normally display all matches. Note that if you use the /S switch with /E, then your variable will be erased from the environment after the last match. UFI will continue to display the entire directory, but -e will be ignored if it is accompanied by /s1 and your environment variable is blank. Bottom line: if the environment variable is blank, then /s1e has the same effect as /s2. Always start a batch file loop with /s0 to set the variable. /Tn - tree search (0 no tree, 1 specified path, 2 entire drive, 3 all drives, 4 floppies also) Tells UFI what kind of file list you are going to search: 0 - no tree search. Current directory only. 1 - specified path (in /P option, or current dir). Searches given path and all directories below that level 2 - entire drive. Searches the entire drive of the given or current path. For example, /P=C: *.BAK will report all .BAK files on drive C. Even if you specify /P=C:\TEST or something, if you include /T2, the drive will be searched from the root. This is handy when you don't want to mess with editing strings in a batch file. Here's an example of how you might use this: Say you want to be able to write a batch file that finds all .BAK files on the drive that the BATCH FILE is on. Simple: here's the batch file: _______ ufi *.bak /T2 /P=%0 REM * all but the drive letter of %0 is ignored. If %0 REM * contains no drive letter, then the current drive is REM * used. 3 - searches every locateable drive on the system, except floppies 4 - like #3, but with floppies. /@n - debug level (n: 0 display all vars, 1 trace, 2 continue on nonfatal) This is not fully implemented in all versions. Requires password. Password is available with registration. /Ln= - set log file name ** UNDER CONSTRUCTION - SOME FUNCTIONS NOT AVAILABLE ** Creates a log file. The action code, n, sets the level of detail: ERROR REPORTING (n below): 0 - ignore I/O errors, report syntax errors and halt (no log file) 1 - report to UFIERROR.LOG and continue on I/O errors (default if /L with no number) 2 - Halt immediately on any I/O error NON ERROR REPORTING n + 0 - log only errors as above n + 10 - log only actions (start, exec, errors, stop) ( 10, 11, 12...) n + 20 - log param information n + 30 - log everything (statistics on hits, etc...) Example: to report I/O errors and log only actions, the action_code will be 11. /H - detailed help (best to print it out) You're looking at it. FILTER SECTION -------------- These options are "filters". They help you filter out unwanted files. /[C|c]= - Contents (not [C]ase sensitive, [c]ase sensitive) This option allows you to filter based on file contents. -c=str Behaves like grep str. -C=str behaves like grep -i str. /Zn - size greater than n (less than |n| if n < 0) /Z4097 will display any file larger than 4096. /Z-4097 will display files 4096 bytes or smaller. /Dn: - filter on date [n: 0 On, 1 on or before, 2 on or after, -1 before, -2 after] date format is MM-DD-(YY)YY Ok, dates get messy. But here it is: -2 shows files with a date LATER than the one you specified. -1 shows files with a date EARLIER than the one you specified. 0 shows files only on the exact date that you specified. 1 shows files with a date EARLIER or THE SAME as the one you specified. 2 shows files with a date LATER or THE SAME as the one you specified. /A: - filters are RHSVDAM. To exclude a file with A, use "a". To include use "A". Filter not present is a don't care. Certain to give you a headache. Ok, the filter string works like this. If the letter for an attribute is there, then the file must match that attribute to be a hit. An UPPERCASE letter represents that the attribute must be ON. Lowercase means OFF. If the letter representing an attribute is not there at all, it's what we engineers call a DON'T CARE. It doesn't matter what the attribute is, the file will be displayed. R - read only H - hidden S - system V - volume label (wanna search for a volume label? Use /A=V !) D - directory (this can be off and tree searches still work,) (but the dirs aren't displayed) A - archive M - share attribute on novell nets. Normally, a DOS directory would use "hsv" as its attrib string, since hidden and system files are skipped and volume labels are not reported as files. Be careful not to do things like /A=VD, as nothing has both a directory and a volume label on. /Xn={str} Execute a program or command based on a DOS shell. The string passed is run through UFI's "~" substitute filter. Each occurrance of "~" represents the file name at the current iteration. If n = 1, then the execution string is written to the console before execution. EXAMPLES -------- For a simple first example, let's do this: > ufi *.* /o7t0a="hsvd" This should look very much like the "dir" command. Actually, most of that command line is superfluous. The -t0 and -a="hsvd" are the defaults, so "ufi /o7" does the same thing. > ufi *.* /o7t2r=~: > fil This will create a file called "fil" which lists every file on disk in a dir-like format. There is one line separating directories containing the directory's full path followed by a colon. > ufi *.* This would look pretty much like a unix ls command. Only the files are listed without any additional information. > ufi *.bat *.txt /x="filter ~" This would call the program or batch file called "filter" for each occurance of *.bat or *.txt in the current dir, passing the file name as the first parameter. > ufi *.exe /o8x=~ Executes every program in the current directory. This could get really fun. > ufi *.bak /o8x="ren ~.bak ~.bku" Same as ren *.bak *.bku. Why use ufi? Take a look: > ufi *.txt /o8x="dos2unix ~.txt ~.unx" How about that? Converts all *.txt files to unix format, in the file *.unx. > ufi program.exe /t3o0x="copy c:\prog\program.exe ~" Updates all copies of program.exe occurring on any currently visible drive. Careful, this is sensitive only to filename. Files called program.exe will be ruthlessly overwritten. In doing something like this, you would probably want to use a program that will prompt first. > ufi *.exe *.com *.bat /A=S /D2=04-31-93 /t2o8x="edit c:\docdir\~.doc" Scans the entire drive for occurrances of the filespec that are SYSTEM files and dates on or later than 4-31-93 and edits a file with a like name but extension DOC in the c:\docdir directory. Some other hints: UFI can call itself in an /x command. How about this: > ufi *.exe -p:c:\ -o1 -x="ufi ~ -p=d:\ -o1 >> fil" This will search for all EXE files on d: that match exactly in name to those on c:., and place the output in "fil". UFI can also be a pretty powerful batch file pal. For example: --------------------------------------------------------------------- @echo off rem First let's find the first match to our criteria... rem ufi *.exe -e=DOCFILE -o8s0d2:01-01-92 > nul rem rem easier on the eyes would be --> ufi *.exe -e=DOCFILE -o8 -s0 -d2:01-01-92 > nul rem if errorlevel 1 goto end :loop rem the variable contains only the first part of the filename (-o8) edit %DOCFILE%.DOC rem rem switch to "findnext" -s1 ufi *.exe -e=DOCFILE -o8s1d2:01-01-92 > nul if errorlevel 1 goto end goto loop rem Could check for DOCFILE! == ! also :end --------------------------------------------------------------------- This batch file locates all the programs with a date later than 01-01-92 and invokes the editor on the .DOC file of the same name. For example, if the directory in question had 1.EXE, 2.EXE, and 3.EXE in it, but only 2.EXE and 3.EXE were 92 or later, then this batch file would call the editor "edit" once for 2.DOC and once for 3.DOC. You could call any program or other batch file here. Think of it as a "for" in which you can choose bits of the filenames. VERSION HISTORY --------------- 1.01c Added "Contents" filter with reasonable speed. Incorporates performance improvements made in 1.01b related to multiple wildcard searches. Also incorporates smarter escaping algorithms for literal strings. Added better online help as requested by Timo Salmi and others. Compiled with latest version of support units. Can't say that this does anything but increase reliability. 1.01b,a not released, improvements not tested. 1.00 First official release. Added Execute (X) functionality, fixed environment problems. UFI now uses the parent (calling) program's environment so that ufi can recursively call itself and not violate its own data. 0.99 First working version. 7 of the 8 options are fully functional. (X) still needs work. /E can be buggy sometimes. AUTHOR CONTACT -------------- Patrick Taylor/Andrologic Internet - exuptr@exu.ericsson.se (1993) BBS - The Sounding Board (a Wildcat! BBS) 214-596-2915 3308 Lanarc Plano, TX 75023 In the event that the author is difficult to find at some point in the future, suggested good places to look would include: * The Wildcat! support BBS * comp.lang.pascal (UseNet) * Look for The Sounding Board on a recent BBS list.