Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cmcl2!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: (R)Find directories only Message-ID: <24486@adm.BRL.MIL> Date: 13 Sep 90 13:08:28 GMT Sender: news@adm.BRL.MIL Lines: 37 In article <1550.26efc4ed@waikato.ac.nz>, iam@waikato.ac.nz writes >I am wondering if people know of some easy way to pick out directories >in Turbo Pascal 5.5? > >I tried FFirst and FNext as specified in the manual but they also get >files as well as directories. That's how they work: no matter what file attributes you specify, you also get the "normal files". You just have to test the file attributes returned each time and filter out the directories. An example from code which does recursive descent into subdirectories below the current directory: if dosub then begin FindFirst(dir+'*.*',Directory,sr); while DosError = 0 do begin {$S+} if (sr.Attr and Directory = Directory) and (sr.Name <> '.') and (sr.Name <> '..') then StampFile(dir+sr.Name+'\'+name+ext,time,True); {$S-} FindNext(sr); end; {DosError = 0} end; {dosub} +-------------------------------------------------------------------------+ | Karl Brendel Centers for Disease Control | | phone 404/639-2709 Epidemiology Program Office | | fts 236-2709 Atlanta, GA | | | | Home of Epi Info 5.0 | +-------------------------------------------------------------------------+