home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
pibterm
/
pibt41e3.zip
/
DIRLIST.SCR
< prev
next >
Wrap
Text File
|
1988-02-26
|
4KB
|
94 lines
***************************************************************************
* D I R L I S T . S C R --- Demonstrates directory access in scripts *
***************************************************************************
* *
* Script: DirList.Scr *
* *
* Purpose: Demonstrates script facilities for listing directory *
* entries. *
* *
* Invocation: *
* *
* Execute "DirList" *
* *
***************************************************************************
*
* Wildcard for files
Declare FSpec String
* Attributes for search
Declare FAttr String
* File name
Declare FileName String
* File attributes
Declare FileAttr String
* File creation date
Declare FileDate String
* File creation time
Declare FileTime String
* File size in bytes
Declare FileSize String
* Report line
Declare ReportLine String
* Counts files found
Declare TotalFiles Integer
*
* Get file spec to search for
*
Writeln
Input "Enter file spec to search for: " FSpec
Writeln
*
* If file spec null, quit.
*
IF ( FSpec = '' ) THEN
Exit
ENDIF
*
* Search for first file.
*
DirFirst FSpec "" FileName FileAttr FileDate FileTime FileSize
*
* No first file -- report that
* and quit.
*
IF ( ( FileName = '' ) OR ( IOResult <> 0 ) ) THEN
Writeln
Writeln "No files found."
Writeln
Exit
ENDIF
* Set files found to 0.
Set TotalFiles = 0
*
* Begin loop over rest of files.
*
WHILE ( LENGTH( FileName ) <> 0 ) DO
*
* Increment file count
*
Set TotalFiles = TotalFiles + 1
*
* Display file stuff
*
Set FileName = CONCAT( FileName , DUPL( ' ' , 14 - LENGTH( FileName ) ) )
Set FileSize = CONCAT( DUPL( ' ' , 12 - LENGTH( FileSize ) ) , FileSize )
Set FileSize = CONCAT( FileSize , ' ' )
Set FileDate = CONCAT( FileDate , ' ' )
Set FileTime = CONCAT( FileTime , ' ' )
*
Set ReportLine = CONCAT( CONCAT( FileName , FileSize ), FileDate )
Set ReportLine = CONCAT( CONCAT( ReportLine , FileTime ), FileAttr )
*
Writeln ReportLine
* Get next file
*
DirNext FileName FileAttr FileDate FileTime FileSize
*
ENDWHILE
* Display final count of files
*
Set ReportLine = CONCAT( 'Total files found: ', STRING( TotalFiles ) )
*
Writeln
Writeln ReportLine