home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////
- // Examples of how to utilize the following System Environment variables:
- //
- // CWD DIR_FILE
- // FILE_ACCESS FILE_ATTRIB
- // FILE_CREATE FILE_OWNER
- // FILE_SIZE FILE_UPDATE
- //
- // This task file displays a listing of file information for all files in
- // a directory.
- /////////////////////////////////////////////////////////////////////////
-
-
- // Variables used:
- //
- // %0 : Directory we want to view
- // %1 : Total number of files
- // %2 : Lines displayed
- // %3 : Display the header (0=yes,1-no)
- // %4 : Current file
- // %9 : Original Working Directory
-
-
- // save the current working directory
-
- DEFINE %9 %CWD%
-
-
- // define 0 as and change to the directory we want to view
-
- DEFINE %0 SYS:\
- CD %0
-
-
- // define total file counter
-
- DEFINE %1 0000
-
-
- // Define variable %2 for line display counts (3=set header)
-
- DEFINE %2 0000
-
-
- // Define variable %3 for header display flag (0=display header)
-
- DEFINE %3 0000
-
-
- // define variable %4 as the first matching entry in the file search
-
- DEFINE %4 %DIR_FILE_*.*%
-
-
- // for file counting, use a WHILE/LOOP which checks if %4 is defined
-
- WHILE "%4">""
-
- // should we prompt to continue
-
- IF %2==0002
- PAUSE
-
-
- // set the header variable
-
- DEFINE %3 0000
-
- ENDIF
-
-
- // display the header information
-
- IF %3==0000
- CLS
- ECHO File Listing for %0
- ECHO.
-
-
- // set the display counter
-
- DEFINE %2 0000
-
-
- // set header variables
-
- DEFINE %3 0001
-
- ENDIF
-
-
-
- // display the file information
-
- ECHO File: %0%4
- ECHO Attributes: %FILE_ATTRIB_%4%
- ECHO Size: %FILE_SIZE_%4%
- ECHO Owner: %FILE_OWNER_%4%
- ECHO Created: %FILE_CREATE_%4%
- ECHO Accessed: %FILE_ACCESS_%4%
- ECHO Updated: %FILE_UPDATE_%4%
- ECHO.
-
-
- // increment %1 for each file found within the directory
-
- DEFINE %1 %1+=1
-
-
- // increment the display counter
-
- DEFINE %2 %2+=1
-
-
- // define variable %4 as the next matching entry in the file search
-
- DEFINE %4 %DIR_FILE_%
-
-
- // LOOP back up to the WHILE check for the next matching file
-
- LOOP
-
-
- // restore the working directory
-
- CD %9
-