ATTRIBUTES OF POWER (C) Copyright 1986 Brian Murphy ATTRIBUTES OF POWER Copyright (c)1986 Brian Murphy TABLE OF CONTENTS Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Attribute/Command symbols . . . . . . . . . . . . . . . . . . . . 3 Search/Set symbols . . . . . . . . . . . . . . . . . . . . . . . . 4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Notes On the D,V,X, and Y Attributes . . . . . . . . . . . . . . . . . 10 Specific Effects Of Attributes . . . . . . . . . . . . . . . . . . . . 11 Sample outputs of "dir" and "AT" . . . . . . . . . . . . . . . . . . . 13 This program requires DOS 2.0 or above and a display width of 80 characters per line for proper operation. RIGHTS, RESPONSIBILITIES, INFORMATION, AND OF COURSE: THAT LEGAL STUFF This program is distributed under the "Userware" concept. This means that you are free to use, copy, and distribute the program and its associated files free of charge. What the author of the program asks in return is that you send a registration fee of an amount which you feel appropriate for the program ($10 suggested). Of course you are under no obligation to send in this registration fee. Not doing so will in no way interfere with your right to use and distribute copies of the program. But look at it from the programmer's point of view. A lot of time went into development and testing of this program, as well as money to find the best compiler for the job to make the final product as quick and painless for YOU to use as possible. Surely $10 is not to much to ask for in return. After all, while public domain programs are for your use, the people who create the truly useful programs are going to get tired of taking the time and effort to make programs which the PC world NEEDS, and distribute them free of charge, if they are not rewarded in some small way for their efforts. Please take the time NOW to send your registration check to: Attributes Of Power c/o Brian Murphy 711 Arch #304 Ann Arbor, MI 48104 ----- Copyright Notice: ATTRIBUTES OF POWER (AT) AND THE ASSOCIATED MANUAL are (C) Copyright 1986 by Brian Murphy. AT, and the accompanying user manual may not be modified or distributed in modified form without the express written permission of Brian Murphy. Furthermore, AT and its manual, or any modified derivative thereof may NOT be sold, or distributed as a bonus accompanying the sale of third party hardware or software. ----- Disclaimer: AT and its manual are distributed without guarantee. Responsibility lies solely with the user. Brian Murphy shall not be held responsible for any damage incurred by the use of AT or the manual to hardware, software, peripheral device, or any loss of productivity or profit resulting from the use of this software. ----- FYI: AT was developed on a Compaq Deskpro 286 using the small version C compiler: "Mark William's Let's C". This compiler was used because it resulted in execution speeds ~40% faster than the same program compiled with Microsoft's V3.0 C compiler. The manual was written using Word Perfect 4.0 ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 1 Quick overview of ATTRIBUTES OF POWER: In a nut shell ATTRIBUTES OF POWER, besides giving you a wealth of information beyond that given by the normal DOS "dir" command, also gives you complete control over the file/system attributes which DOS supports but hasn't made available to the general user. The control of attributes such as the read-only attribute, which protects your files from accidental erasure and alteration, or the archive attribute which allows custom tailoring of files to be archived with DOS's "backup" and "restore" commands, or the hidden attribute which allows you to eliminate the utility files which continually swamp out the files you really want to see in your "dir" listings, is the kind of control AT puts at your fingertips. Of course there are several programs currently available which allow one to change the attributes of files, so what makes AT so unique? AT is the only program which allows you to perform directory searches and subsequent attribute modifications based on file specifications, attribute specifications, or combinations of both. This ability, coupled with the ease of issuing multiple attribute setting commands from a single command line, gives you the added control and flexibility which is necessary for full and easy use of the attributes on your system, allowing you to capitalize on the options which come with such added potential. With this program you have complete control over the attributes which the operating system has supported all along, but which have been out of reach because until now you, the user, had been provided with no simple method for manipulating them. Installation: Fixed Disk: If you have a hard disk, you should copy AT to the directory which contains DOS. If you do not have a DOS directory, the easiest thing to do is to copy AT to the fixed disk's root directory; for example, put the AT disk into drive A and type: "copy a:\at.exe c:\" (assuming your hard disk is drive C). In addition, you should use the "path" command to specify the root directory of you hard disk as part of your command search path. This may be done as follows: If you have a "path" command in an autoexec.bat file on your hard disk's root directory, append the following to it: ";C:\" so it would look like "PATH=(whatever you had previously)\;C:\" (again assuming your hard disk is drive C). If you have an autoexec.bat file, but do not have a path command in it, add the line "PATH=C:\" to it. If you do not have an autoexec.bat file in the root directory of your hard disk you may create one by typing the following: C:{Enter} (Assuming your hard disk is drive C.) cd\{Enter} copy con autoexec.bat{Enter} path=C:\{Enter} (Again, assuming C is your hard disk.) ^Z{Enter} (Press CTRL and Z simultaneously, or F6.) ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 2 Floppy Disk: Copy AT to the floppy disk where you want to use it. In most cases this will be your working DOS diskette. For example, if your DOS diskette is in drive A, put the AT diskette in drive B and type "copy b:\at.exe a:\". Note: AT, like any program, will only run if it is 1) in the current working directory, or 2) if it is in the command path search set by the "path" command. If one of these criteria are not met, when you type AT{enter} you will get the following message: "Bad command or file name". To correct this problem you must change either the command search path, or copy AT.EXE to the current working directory. TEST SPIN: You can use AT in many ways, the easiest of which is just like the DOS "dir" command. Simply type "AT" and return. On a more advanced level you can use AT in conjunction with specific search patterns you create to look for filespec/attribute combinations, and, at your option, change the attributes on files which match those search patterns. Below is an example of how AT works which shows how to set the read-only attribute on the installed copy of AT and thus make it immune to accidental erasure or modification. Change AT's attributes: To protect AT now that it is on the disk where you will be using it, make sure that disk is the current default disk, and that AT.EXE is in the current default directory (both conditions are met if you see AT.EXE when you get a "dir" listing) and type the following: at at.exe /+r{Enter} This command will invoke AT and cause it to set the read-only attribute on AT.EXE while telling you it has done this by placing a "*" at the end of AT.EXE's attribute listing line. Congratulations! With this one simple command you have demonstrated all the skills necessary to use AT. What follows are the details of running AT by specifying search parameters, an explanation of AT's output, and definitions of specific attributes and their functions; but remember, anytime you want a directory listing, just type AT! ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 3 USAGE: 1) AT {Enter} Nice and simple, like "dir", or . . . 2) AT filespec {Enter} and still on comfortable ground, or . . . 3) AT [filespec] [/{*=~/+-rashvdxycwb]}{...}. .] {Enter} and POWER! Command: What it does: 1) AT Expands to AT *.*; gives complete listing of current directory. 2) AT filespec Expands to AT filespec, (or filespec.* if you do not supply a file extension). Note that this method of extension expansion is slightly different from DOS's "dir" in one respect: with this convention c:\path1\path2 expands into c:\path1\path2.* "look for file path2 in directory path1" instead of DOS's "look in directory path2 for any files". If this is what you mean, you must enter c:\path1\path2\ Other than this AT works with file names the same way DOS's "dir" command does. 3) The third command format, which is where AT is at its best, has an added element which the first two formats do not, and that is the command field. The command field is composed of combinations of two kinds of symbols, the attribute/command symbols, and the search/set symbols. The attribute/command symbols tell AT what attributes you want to look for, the search/set symbols tell AT how to look for these attributes (e.g. find any file which has all specified attributes, or find any file which has none of the specified attributes), and what you want to do with the matching files found (set or reset specified attributes). Attribute/Command symbols: attributes: r - read only s - system h - hidden v - volume a - archive d - directory x - Xunused y - Yunusd commands: b - blank w - wide c - clear Note: See the section titled "Specific Effects Of Attributes" for an explanation of what specific attributes are used for. Also, be aware that the attributes X and Y are unused by the current version (3.1) of DOS. As soon as a version of DOS is released which allows you to manipulate them, this program is written to allow you to do so. ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 4 The "b","w","c" command symbols are not attributes. They are commands to AT. The 'b' command tells AT to look for files which have no attributes set ("b"lank). The 'w' symbol ("w"ide) tells AT to give a condensed report, omitting a display of individual file times, dates, sizes, slack, etc. This mode is like the "dir /w" report. For the individual files, all you get are the file names and their attributes. The 'c' symbol ("c"lear) tells AT to clear the attributes of all the files it finds. This is the only symbol of the attribute/command symbol group which alters the attributes of files. The symbols which control the searches are listed below. All symbols may be used in any logical combination (and AT can figure out most illogical combinations as well). If you specify more than one condition in the command field, only files which meet all the conditions will be listed. The best way to figure out how AT works is to look at the examples which follow, and play (on a spare floppy if you feel uneasy). Attribute Search/Set Symbols: In what follows, xxx represents an arbitrary combination and number of the attribute characters "rhshavdxy". You should specify at least one attribute after a search/set symbol, but may specify more. Note that the command field must begin with a "/". / : /xxx -> search for files with any of the specified attributes. The "/" may be omitted if the xxx characters immediately follow the command "/". + : +xxx -> set the listed attributes. - : -xxx -> reset the listed attributes. ~ : ~xxx -> search for files which do not have any of the listed individual attributes. = : =xxx -> search for files which only have all of the listed attributes. ~= : ~=xxx -> search for files which do not contain this complete block of attributes. =~ : =~xxx -> (same as ~=). * : *xxx -> search for files which have at least all of the listed attributes. The attribute/command and search/set symbols may be combined in many ways. Following is a very small sampling of the possibilities. ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 5 EXAMPLES: Note: the examples do not take into account the 'x', and 'y' attributes since they are currently not used. An extension to the use of these attributes requires no more than a straightforward application of the principles illustrated below with the attributes currently available. at /~hsv This says: "List any files in the current default directory which do not have either the 'h','s', or 'v' attributes." This command combination gives a listing which is the equivalent of DOS's "dir". Only files with a combination of the 'a','r', or 'd' attributes (and no others) are listed. at /a This says: "Look in the current default directory, and list any files which have the 'a' (plus any other attributes) set". If you have not purposely manipulated the 'a' attribute of these files, such a listing would show you all the files on your disk in the current root directory which have been created or modified since they were last backed up with DOS's "backup" command. at /dhs This says: "Look in the current default directory, and list all subdirectories which have been hidden with the 'h', 's', or both attributes." at c:\123\ /c This says: "Clear the attributes of all files in the C:\123 directory." The command is handy if you want to eliminate a subdirectory. This will turn off all read-only, hidden, and system attributes of all files in the directory, thus allowing you to delete them with a single "del *.*". Note that if you didn't have AT, and a commercial program had transferred hidden files to a directory (as many do), you would be unable to erase that directory. Some people have faced this maddening experience: the "dir" command shows the directory as being empty, but when you try to erase the directory with "rd" DOS tells you the directory isn't empty. With AT such paradoxes vanish with a few keystrokes. Without AT you would be stuck. Period. at /a~r-a+r This says: "Look in the current default directory for any files which have the 'a' attribute, plus any other attributes besides the 'r'. For those files, turn 'a' off, and turn 'r' on". A similar command is "at /a~rc+r". There is a difference though: the former command turns only the 'a' attribute off, and sets the 'r'. The latter turns all attributes off and sets the 'r'. This is an easy way to find out which files are new or which have been modified in a directory, but are currently not write protected, and then protect them from accidental erasure or modification. ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 6 at c: /=shrc+r This says: "Look in the C: default directory. If there are any files which have both attributes 's','h','r' and no others, clear these attributes and make the files read only". Note that the 'c' command is always executed first, so "at c: /=shr+rc", "at c:/=cshr+r", and at "c: /c=shr+r" all have the same effect. This command would effectively unhide the write protected hidden and system files in the directory, while still protecting them from accidental erasure or modification. An equivalent command would be "at c: /=shr-sh". at data /b+a This says: "Look for all files of the form 'data.*' in the current directory which have no attributes set and turn on their 'a' attribute." The 'b' command, like the 'c' command, is always executed first, so the commands "c: /+ba", and "c: /+ab" would have the same effect as the one above. at /*sh-s This says: "Look for all files in the current directory which have both the 's' and 'h' attributes, as well as any others, and turn the 's' attribute off. Files with an 'h' but not 's', or an 's' but no 'h', or neither an 's' or 'h' will not be affected. at data path1\path2\ /+sh-ac This says: "Look for data.* in '(current drive\directory)\path1\path2\*.*'. For all files of that form in that directory, clear their attributes and turn on the 's','h' attributes and turn off the a attribute". Note the -a is really not needed because the 'c' turns off all attributes on the specified files. at accounts /d+h This says: "Look for any subdirectories in the current directory named 'accounts' (while ignoring any files of the form 'accounts.*') and turn on the 'h' attribute." This will effectively hide the "accounts" directory from any normal DOS "dir" listings. The subdirectory may still be entered via "cd" as usual if you know it's name, and will be backed up as normal with the DOS "backup" command. at /+wr~c=rh This is an exemplary bit of illogic, if ever there was one, to give you an idea of how AT goes about deciphering the command line. Despite the confusion, AT knows what you meant (do you?). It knows you mean: "Search for all files which satisfy "~=rh", "c"lear them and turn on 'r'. Finally, print out the results in wide format. You didn't really think it mean turn on the 'w' and 'r' attributes for any file which doesn't have the 'c' attribute and has only the 'r','h' attributes did you? ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 7 This brings us to a the way AT parses you command line. All commands are initiated with the "/". Without this, AT will ignore whatever you type after the first field following "AT". Once AT encounters the "/", it knows you're issuing a command and sets about deciphering it. When AT encounters one of the search/set mode indicators (=,/x,*,+,-,~), it treats all attribute letters following that symbol as belonging to it. Things proceed in this manner until another search/set mode indicator is encountered. Then the following attribute letters correspond to that mode, and so on. The special command symbols 'b', 'c', and 'w'. are noted when AT finds them, but since they are not attribute letters they are ignored, or considered invisible, to the part of AT which is associating attributes with mode/set indicators. Because of this way of parsing the command line, the order in which commands are issued does not matter, so "AT /=rh+a-s", "AT /-s+a=rh", and "AT /+a+rh-s", etc. are equivalent. What counts is what letters follow the previous set/mode symbol. As mentioned earlier the 'c' and 'b' command are always executed before any others, so a command of the form "/+ac+h" does not set the 'a' attribute, then clear it and set the h attribute. This command would clear all attributes and then set the h & a attributes. ERROR MESSAGES: If you issue commands which contain illegal characters, AT will prompt you with an error message which shows you the command you tried, and the illegal characters [within square brackets]. AT will not, however, balk at obviously meaningless expression such as "AT /=a~a" which tell it to "search for all files which have only the 'a' attribute, but which do not have the 'a' attribute." AT will proceed as usual and simply give you the "No files found" message. ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 8 OUTPUT: Below is an explanation of the output you get in the various AT modes. For a visual guide to go along with the explanations, see the sample AT listings at the end of this manual. VOLUME LABEL: First AT prints the Volume label (if any) of the media (disk) you are reading from. If there is no label, you are told that. PATH SPECIFICATION: Next comes the path specification. This tells you the device, path, and file name you told AT to look for. All components (such as device, path, etc) default to their current values if not specified. Note that the path listing also displays any wildcards you may have specified in your original command. Contrast this to the "dir" path listing which says "Directory of A:\ACCOUNTS" whether you typed "dir a:\accounts" or "dir a:\accounts\paid.up". This is useful if you make printed directory listings for reference or distribution. Now you will know if the directory listing you hold in you hand is of a complete directory, or a partial one. COMMAND FIELD: Following the path display, AT prints the commands you gave it (if any) in between the "[...]" symbols. INDIVIDUAL FILE LISTINGS: ATTRIBUTE LINE: Next comes the file listings, which begin with the attribute line. This line has a "_" in places where no attributes are present, or a character representing attributes which are set. Following this line, depending on the command you issue, you may see the file name, a "*", or an "E". If one of these single character symbols is present, It mean you issued a "change attributes" command, and AT is letting you know the results of that command. Whenever AT changes the attributes of a file, it puts a "*" next to the attribute line of the file whose attributes were changed. The attributes listed are the new attributes. If AT tries to change the attributes of a file and DOS won't let it, instead of the "*", a "E" appears with the file's current attributes. If you order the attributes on a file changed, and no "*" appears, that means the file was already set to the attributes you specified. ATTRIBUTES OF POWER, V2.2; September 22, 1986 pg 9 FILESPEC, TIME, DATE: Next come the File Name and File Extension (or