Episode: 3610 Title: HPR3610: DOS Wildcards; File Attributes Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3610/hpr3610.mp3 Transcribed: 2025-10-25 02:06:59 --- This is Hacker Public Radio Episode 3,610 for Friday, 3 June 2022. Today's show is entitled, DOS Wild Cards. File Attributes and is part of the series DOS it is hosted by AUKA and is about 15 minutes long and carries a clean flag. The summary is, more on DOS this time it is DOS Wild Cards and File Attributes. This episode of HBR is brought to you by an honesthost.com. Get 15% discount on all shared hosting with the offer code HBR15. That's HBR15. Better web hosting that's honest and fair at an honesthost.com. Hello, this is AUKA, welcoming you to Hacker Public Radio in another exciting episode in our DOS series. I want to talk about Wild Cards and File Attributes and the reason I'm slotting this in right here is that it turns out we can do interesting things with them when we're using the directory command. So before I can complete that look at the directory stuff I need to kind of explain what Wild Cards and File Attributes are all about as they are in DOS. Now Wild Cards are characters that can be used to stand in for unknown characters in File Names. Now if you ever played card games the Wild Cards is a card that can match up with any other card. In DOS Wild Cards characters can match up with any character that is allowable in a file name. Now I say allowable you know there are some characters that are reserved for operating system use and cannot be used and I think we've talked about that already. So there are two Wild Cards in DOS. One is the asterisk or star and that matches up with any combination of allowable characters. So it could be one, two, four, eight, whatever. Then there is the question mark Wild Cards and that matches up with any single allowable character. Now since those two characters are used for Wild Cards they are in fact an example of characters that are not allowed in File Names. A file name like MyFileQuestionMark.txt would not be allowed. If you tried to create a file with this name you would get an error message bad file name. But Wild Cards are very useful in any DOS command which uses a file name as an argument which is most DOS commands if you think about it. Now the asterisk command can stand in for any number of characters. Some examples of this command. Let's say you were at the C prompt C colon back slash greater than and you're basically in the root of the C direct C drive. So type the command DEL space asterisk period DOC. Well this command would delete every file with the DOC extension from the root directory of C. So files like MyFile.DOC, TestFile.DOC and one, two, three, they would all be deleted. Here's another example. Copy a b star dot txt space a colon. This command would copy every file that begins with a b and had an extension of txt to the floppy drive a colon. So files like abstract dot txt, abalone dot txt and aba dot txt would all be copied. Now let's say you wanted to do a little housekeeping. Let's say you're in the temp directory. Now the idea of a temp directory is it should be stuff that can be deleted at any time. It's only supposed to exist temporarily. So if you wanted to clean that out, let's say you're at your prompt now is reading C colon back slash temp back slash greater than. So that's telling me my current working directory. And at that prompt I could type DEL space asterisk period asterisk. That's the fastest way to clean out an entire directory. Delete every file in the directory. Now the first apostrophe covers every file name and the second one covers every extension. Now the question mark wild card stands in for any single character. Some examples of this command. Again I'm at the C drive C colon back slash greater than. I'm at the root of the C drive. I type the command DEL space question mark period DOC. This command would only delete files that had a single character file name and a DOC extension from the root directory. So a file like a period DOC or one period DOC is gone its history. But a file like IO.DOC is perfectly safe since it has two characters. Another example. Again let's assume we're at the root of the C drive C colon back slash greater than. We issued the command copy space AB question mark period TXT space a colon. This command would copy any file with a three letter name of which the first two letters were A and B and had a TXT extension. Any file matches that would then get copied to floppy drive A colon. So files like ABZ.TXT and AB2.TXT would be copied. Now you can combine those in a command. So let's take an example. Here we're going to suppose we're in the temp directory. So our prompt looks like C colon back slash temp back slash greater than. And at that prompt we type in DEL space. Asterisk AB question mark period DO question mark. Now this command would be very selective. It would look in the temp directory for files that anywhere from one to five beginning characters. Maximum is five in this case because you can only have eight characters in the name and the other three are accounted for. So anywhere from one to five beginning characters followed by AB followed by one character. And then on the extension side it have an extension of DO followed by any one character. And it would then delete any such files that it finds. So examples of matching files might be ITAB3.DOX. That one's gone. M-E-A-R-A-B-T dot DOQ. This is history. 123-ABC dot DOC. That is gone. Now the file A-L-L-A-B-O-N dot DOC would not be deleted because it does not match. It has two characters following the letters AB in the file name. And the command specified one character in that position. So that's your stuff on wildcards. Now attributes is the other thing that can be very useful. And every file in DOC has four attributes. These are the read only attribute, the archive attribute, the system attribute, and the hidden attribute. So as we saw in the previous one, every file has an entry in the directory. And in that entry there are four bits, one each for the four attributes. These attributes are turned on if the bit is set to one and turned off it is set to zero. Now if the read only attribute is set, it would let you read the contents of a file but you cannot modify it in any way. You would first have to turn the read only attribute off and then you can modify, delete, or move the file. Now the archive bit is set on when the file is first created. And then set off when the file has been backed up by a software backup program. And programs are written to make use of this feature. If the file is ever modified, the archive bit is turned back on. That way the software that does the backup can look at the archive bit on each file to determine if it needs to back it up. So for doing incremental backups, this is important. Back in the days when DOC was really an important operating system, storage space was at a premium and there was expansive. So you wanted to do incremental backups. I remember getting a tape drive to do backup and I would backup my computer onto tape and then take it into my office at the university so that I had an offsite backup for it. Now the system, the system attribute is used to mark a file as a system file. Now in earlier versions of DOC, a file's mark system worked completely off limits without specialized utilities. But now the attribute mostly serves as a warning. Now the hidden attribute is used to prevent a file from being seen by other commands. If you try to clean out a directory, there were sub-directories such as by using the DEL space star period star command and then you try to remove the sub directory, you might get an error sometimes saying the sub directory is not empty. And if that's the case, you know you have a hidden file in there that was not deleted even with the file cards. Now you can view the attributes for any file using the DOC command atrib ATTRIB. If you run the command without any arguments, you will get a listing of all the attributes that are turned on for every file in the sub directory you're in. So let's again we'll say we're in the C temp C colon back slash temp back slash greater than that's our that's our prompt and we just type in ATTRIB. Well this will give you a list of all of the files in the C temp directory. For every attribute that is turned on you will see a letter A for archive S for system H for hidden and R for read only at the beginning of the line. Now you can also look at the attributes for any one file by including the file name with an optional path as an argument in the command. So I could do ATTRIB space myfile.txt and I would get that or if I want to get something that's in a different sub directory I include the path so ATTRIB space C colon back slash docs back slash 123.doc. I can see then what the attributes are for that file. Now you can change the attributes for any file by making the following arguments in the command plus R makes a file read only minus R removes the read only status and makes the file editable again plus A turns on the archive bit in other words flags this file is not having been backed up minus A turns off the archive bit in other words shows the file is having been backed up plus S marks the file is a system file minus S removes the system file designation plus H makes the file hidden to other commands minus H reveals the file to other commands. So let's say I'm again I'm at the C temp is my present working directory I issue the command ATTRIB space minus H space H ID fi le dot txt well that file hidden file will now be visible to other dots commands. Now you can chain these together if you wish so again at the prompt I could type ATTRIB space minus H space minus R space my file dot txt a little both reveal the file my file dot txt and make it editable and deleting. Now with these two concepts of wild cards and attributes we're ready for the next lesson which will make us experts in using the DIR command. So this is Huka for Hacker Public Radio signing off and is always encouraging you to support free software bye bye you've been listening to Hacker Public Radio at Hacker Public Radio dot org. We are a community podcast network that releases shows every weekday Monday through Friday. Today's show like all our shows was contributed by an HBR listener like yourself. If you ever thought of recording a podcast and click on our contributing to find out how easy it really is. Hacker Public Radio was founded by the digital dog pound and the infonomicon computer club and it's part of the binary revolution at binrev.com. If you have comments on today's show please email the host directly leave a comment on the website or record a follow-up episode yourself. Unless otherwise status today's show is released on the creative comments, attribution, share a like, free dot org license.