home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / basic / bmag / dirudemo.bas < prev    next >
Encoding:
BASIC Source File  |  1994-04-13  |  1.7 KB  |  63 lines

  1. '─ Area: F-PowerBASIC ─────────────────────────────────────────────────────────
  2. '  Msg#: 27                                           Date: 07 Apr 94  20:04:14
  3. '  From: Frank Cox                                    Read: Yes    Replied: No 
  4. '    To: David Wrobel                                 Mark:                     
  5. '  Subj: Re: The Rules
  6. '──────────────────────────────────────────────────────────────────────────────
  7. '===========================================================================
  8. '                         DIRDEMO.BAS
  9. '
  10. ' Demo program using Unit DIRU.PBU to retrieve directory information
  11. ' from DTA of last PowerBASIC DIR$ statement executed.
  12. '
  13. ' CopyRight 1991 by Dave Navarro, Jr.               All Rights Reserved
  14. '
  15. '===========================================================================
  16. $LIB ALL OFF
  17. $ERROR ALL OFF
  18. $LINK "AGDIRU.PBU"
  19. '---------------------------------------------------------------------------
  20.  
  21. CLS
  22.  
  23. 'Count the number of files
  24. FileNames%=0
  25. T$=DIR$("*.*",16)
  26. WHILE T$<>""
  27.   INCR FileNames%
  28.   T$=DIR$
  29. WEND
  30.  
  31.  
  32. 'Dimension an array to hold the entire DIR
  33. DIM FileName$(1:FileNames%)
  34.  
  35. 'Place the entire directory into the array in DOS's DIR format
  36. Indx%=0
  37. T$=DIR$("*.*",16)
  38. WHILE T$<>""
  39.   INCR Indx%
  40.   FileType% = FileAttrib%
  41.   T$=LEFT$(T$+SPACE$(13),13)
  42.   IF FileType% AND 16 = 16 THEN
  43.     FileName$(Indx%)=T$+"  <DIR>  " + FileDate$ + " " + FileTime$
  44.    ELSE
  45.     T$ = T$ + USING$("#######  ",FileSize&)+FileDate$+" "+FileTime$
  46.     FileName$(Indx%)=T$
  47.   END IF
  48.   T$=DIR$
  49. WEND
  50.  
  51. 'Display the array to make sure we got it
  52. FOR I%=1 TO FileNames%
  53.   PRINT FileName$(I%)
  54. NEXT I%
  55. PRINT
  56. PRINT "Found";FileNames%;"files"
  57. PRINT
  58.  
  59. PRINT "Press Any Key"
  60. WHILE INKEY$="":WEND
  61.  
  62. END
  63.