home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / timevent / taskmstr / listfile.tsk < prev    next >
Encoding:
Text File  |  1995-05-07  |  2.3 KB  |  129 lines

  1. /////////////////////////////////////////////////////////////////////////
  2. // Examples of how to utilize the following System Environment variables:
  3. //
  4. //    CWD               DIR_FILE
  5. //    FILE_ACCESS       FILE_ATTRIB
  6. //    FILE_CREATE       FILE_OWNER
  7. //    FILE_SIZE         FILE_UPDATE
  8. //
  9. // This task file displays a listing of file information for all files in
  10. // a directory.
  11. /////////////////////////////////////////////////////////////////////////
  12.  
  13.  
  14. // Variables used:
  15. //
  16. //   %0 : Directory we want to view
  17. //   %1 : Total number of files
  18. //   %2 : Lines displayed
  19. //   %3 : Display the header (0=yes,1-no)
  20. //   %4 : Current file
  21. //   %9 : Original Working Directory
  22.  
  23.  
  24. // save the current working directory
  25.  
  26. DEFINE %9 %CWD%
  27.  
  28.  
  29. // define 0 as and change to the directory we want to view
  30.  
  31. DEFINE %0 SYS:\
  32. CD %0
  33.  
  34.  
  35. // define total file counter
  36.  
  37. DEFINE %1 0000
  38.  
  39.  
  40. // Define variable %2 for line display counts (3=set header)
  41.  
  42. DEFINE %2 0000
  43.  
  44.  
  45. // Define variable %3 for header display flag (0=display header)
  46.  
  47. DEFINE %3 0000
  48.  
  49.  
  50. // define variable %4 as the first matching entry in the file search
  51.  
  52. DEFINE %4 %DIR_FILE_*.*%
  53.  
  54.  
  55. // for file counting, use a WHILE/LOOP which checks if %4 is defined
  56.  
  57. WHILE "%4">""
  58.  
  59.   // should we prompt to continue
  60.  
  61.   IF %2==0002
  62.     PAUSE
  63.  
  64.  
  65.     // set the header variable
  66.  
  67.     DEFINE %3 0000
  68.  
  69.   ENDIF
  70.  
  71.  
  72.   // display the header information
  73.  
  74.   IF %3==0000
  75.     CLS
  76.     ECHO File Listing for %0
  77.     ECHO.
  78.  
  79.  
  80.     // set the display counter
  81.  
  82.     DEFINE %2 0000
  83.  
  84.  
  85.     // set header variables
  86.  
  87.     DEFINE %3 0001
  88.  
  89.   ENDIF
  90.  
  91.  
  92.  
  93.   // display the file information
  94.  
  95.   ECHO File:       %0%4
  96.   ECHO Attributes: %FILE_ATTRIB_%4%
  97.   ECHO Size:       %FILE_SIZE_%4%
  98.   ECHO Owner:      %FILE_OWNER_%4%
  99.   ECHO Created:    %FILE_CREATE_%4%
  100.   ECHO Accessed:   %FILE_ACCESS_%4%
  101.   ECHO Updated:    %FILE_UPDATE_%4%
  102.   ECHO.
  103.  
  104.  
  105.   // increment %1 for each file found within the directory
  106.  
  107.   DEFINE %1 %1+=1
  108.  
  109.  
  110.   // increment the display counter
  111.  
  112.   DEFINE %2 %2+=1
  113.  
  114.  
  115.   // define variable %4 as the next matching entry in the file search
  116.  
  117.   DEFINE %4 %DIR_FILE_%
  118.  
  119.  
  120. // LOOP back up to the WHILE check for the next matching file
  121.  
  122. LOOP
  123.  
  124.  
  125. // restore the working directory
  126.  
  127. CD %9
  128.  
  129.