CM> If I pass DIR$("*.TXT") I can't get the subdirectories "*." and if I p
CM> "*." I can't get the "*.TXT" files. [Problem is also that not all dire
CM> are "*.", we can make a directorie called "MY.DIR" and do "C:\>CD MY.D
CM> I have thought that only solution is to get "*.*" and doing a subrutin
CM> order to pass a filter.
You need to give attribute 16 to get directories. Unfortunately it
also gives files, so you need to check the DTA after each dir$ to see
if its a directory or a file. Not too hard to do. Here is some sample
code:
d$=""
do
if d$="" then d$=dir$("*.*",16) else d$=dir$
if d$="" then exit loop
reg 1,&h2f00 'ah=2Fh get disk transfer area (DTA)
call interrupt &h21
dtaseg%=reg(9)
dtaofs%=reg(2)
def seg=dtaseg%
fa%=peek(dtaofs%+21) 'attribute for file located at offset+21
def seg
'test attribute for directory
if (fa% and &b10000) then
'its a directory
print "directory: ";d$
else
print "file: ";d$
end if
loop
You can then test the extensions of the files to parse out .TXT, .DOC,
etc as you see fit. If you want more info on the DTA (you can also
get file size, date, time and all attributes from DTA data) call the PB
BBS. There is also a routine that will get the entire tree of a hard
disc on there that I posted a few years ago, also a program that will
search entire hard drive for .BAK files and delete them that I posted
as well. Eric
--- QM v1.00
---------------
* Origin: Creekside Manor (805) 484-8016 CdCom Support BBS (1:206/2512.0)
|