` Printed Icetips Article

Icetips Article



Par2: Reading Directories
2004-12-20 -- Jason S
 
MyQueue  Queue, PRE(MYQ)
FullPath    string(2000)
end
AllFiles       QUEUE(File:queue),PRE(FIL)      !Inherit exact declaration of
File:queue
              END

LOC:Path      string(2000)
LOC:Counter   LONG
LOC:Inner     LONG


! End of "Data Section"
  CODE
! Start of "Processed Code"
! [Priority 5000]
  MYQ:FullPath = 'D:\Program Files\'
  add(MyQueue)

  LOC:Counter = 0
  loop
    LOC:Counter += 1
    get(MyQueue, LOC:Counter)
    if errorcode()
      BREAK
    end
    LOC:Path = MYQ:FullPath
    free(AllFiles)
    DIRECTORY(AllFiles,clip(LOC:Path) & '*.*',ff_:DIRECTORY)
    LOC:Inner = 0
    loop
      LOC:Inner += 1
      get(AllFiles, LOC:Inner)
      if errorcode()
        BREAK
      end
      IF BAND(FIL:Attrib,ff_:DIRECTORY) AND FIL:ShortName <> '..' AND
FIL:ShortName <> '.'
        MYQ:FullPath = clip(LOC:Path) & clip(FIL:name) & '\'
        add(MyQueue)
      end
    end
  end



Printed November 21, 2024, 6:53 am
This article has been viewed/printed 35232 times.