home *** CD-ROM | disk | FTP | other *** search
- '─ Area: F-PowerBASIC ─────────────────────────────────────────────────────────
- ' Msg#: 27 Date: 07 Apr 94 20:04:14
- ' From: Frank Cox Read: Yes Replied: No
- ' To: David Wrobel Mark:
- ' Subj: Re: The Rules
- '──────────────────────────────────────────────────────────────────────────────
- '===========================================================================
- ' DIRDEMO.BAS
- '
- ' Demo program using Unit DIRU.PBU to retrieve directory information
- ' from DTA of last PowerBASIC DIR$ statement executed.
- '
- ' CopyRight 1991 by Dave Navarro, Jr. All Rights Reserved
- '
- '===========================================================================
- $LIB ALL OFF
- $ERROR ALL OFF
- $LINK "AGDIRU.PBU"
- '---------------------------------------------------------------------------
-
- CLS
-
- 'Count the number of files
- FileNames%=0
- T$=DIR$("*.*",16)
- WHILE T$<>""
- INCR FileNames%
- T$=DIR$
- WEND
-
-
- 'Dimension an array to hold the entire DIR
- DIM FileName$(1:FileNames%)
-
- 'Place the entire directory into the array in DOS's DIR format
- Indx%=0
- T$=DIR$("*.*",16)
- WHILE T$<>""
- INCR Indx%
- FileType% = FileAttrib%
- T$=LEFT$(T$+SPACE$(13),13)
- IF FileType% AND 16 = 16 THEN
- FileName$(Indx%)=T$+" <DIR> " + FileDate$ + " " + FileTime$
- ELSE
- T$ = T$ + USING$("####### ",FileSize&)+FileDate$+" "+FileTime$
- FileName$(Indx%)=T$
- END IF
- T$=DIR$
- WEND
-
- 'Display the array to make sure we got it
- FOR I%=1 TO FileNames%
- PRINT FileName$(I%)
- NEXT I%
- PRINT
- PRINT "Found";FileNames%;"files"
- PRINT
-
- PRINT "Press Any Key"
- WHILE INKEY$="":WEND
-
- END
-