BBS: SPOKANE CENTRAL
Date: 05-20-93 (14:06) Number: 39
From: GOODGUY #22 @5290 VIRTUAL Refer#: NONE
To: ALL Recvd: NO
Subj: Reading disk directories. Conf: (18) QuickBASIC
0R: net33: @5912 (via @1042) [23:04 05/27/93]
0R: net33: @6850 (via @6852) [22:09 05/26/93]
T#@> Hello. I am a Quick BASIC and a Visual BASIC programmer. In one of m
T#@>resent programs, I need to know the names of all the directories on my hard
T#@>disk (put them in an array). Before, I just did this:
I assume that you are using Basic rather than Visual Basic because all
that stuff is redily available in list boxes in VB. I think in Basic
the "Files" procedure will retrieve the file names but not Sub's, is
that right? I'll give you the Basic routine I found and Assembler
routines testing for SubDirectorys and let you go from there. I know,
it's assembler but everything of value takes a little work (Translate,
test) at least, right?
110 DEF SEG=&H2000
140 FOR N=1 TO 112
160 FOR M=0 TO 10
180 NEXT M
190 IF X$-FILENAME$ THEN 220
200 NEXT N
210 PRINT "FILE NOT FOUND":END
230 IF X AND 32 <> 0 THEN PRINT "FILE NOT BACKED UP"
240 IF X AND 16 <> 0 THEN PRINT "FILE IS A SUBDIRECTORY"
250 IF X AND 8 <> 0 THEN PRINT "FILE IS A VOLUME LABEL"
260 IF X AND 4 <> 0 THEN PRINT "FILE IS A SYSTEM FILE"
270 IF X AND 2 <> 0 THEN PRINT "FILE IS A HIDDEN FILE"
280 IF X AND 1 <> 0 THEN PRINT "FILE IS A READ ONLY FILE"
subdirectories for sub....
if that doesn't work then here's a snippet the Assembler code for
testing a file for the subdir attribute
; TEST ATTRIBUTE BYTE FOR SUBDIRECTORY
;---In the Data Segment
PATH DB "File name to be tested in ascii0 format"
; end it with a "0"
;---In the code segment
MOV AH,43H ;Get/set attribute function
MOV AL,0 ;Get the attribute byte (1 = set byte)
LEA DX,PATH ;Point DS:DX to the files path
INT 21H ;Get attribute byte and put it in CX
JC ERROR_ROUTINE ;On error go to your recovery routine
CMP CL,00010000B ;Test bit 4 for subdir
; 0 = read only
; 1 = hidden
; 2 = system
; 3 = volume label
; 4 = subdirectory
; 5 = backup bit
; 0 and rest are not used
You'll probably have gotten a better answer by now but thought I'd throw
this in just incase. Hope it helps...
The Heart of Gold (HOG) BBS 1(408)732-8958 @1408000-VirtualNET @4080-HOGnet
Sysop: friday jones Sunnyvale, California USA VBBS 6.00 USR V32/V42BIS
"Where the rats have more delectibly-delicious CRUNCH!"
0Via: 1408005*1 6160*1 5092*1