OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


SysFileTree

 
 Function: SysFileTree 
 Syntax:   rc = SysFileTree(filespec, stem, [options], [tattrib], 
           [nattrib]) 
      filespec  The filespec to search for. 
      stem      The name of the stem variable to place the results. 
                Note:    stem.0 contains the number of files and/or 
                directories found. 
      options   Any logical combination of the following: 
           F         Search for files only. 
           D         Search for directories only. 
           B         Search for both files and directories. (default) 
           S         Scan subdirectories recursively. (non-default). 
           T         Return time and date fields in the form: 

                     YY/MM/DD/HH/MM
                     
                     
           O         Only report fully qualified file names.  The default 
                     is to report date, time, size, attributes and fully 
                     qualified file name for each file found. 
      tattrib   The target attribute mask used when searching for filespec 
                matches. Only filespecs which match the mask will be 
                reported.  The default mask is '*****' which means the 
                Archive, Directory, Hidden, Read-Only, and System bits may 
                be either set or clear.  The attributes in the mask are 
                positional dependant and in the alphabetical order 
                'ADHRS'. 
           Mask Options (Target Mask) 
                *         The specified attribute may be either set or 
                          clear. 
                +         The specified attribute must be set. 
                -         The specified attribute must be clear. 
                Examples: (Target Mask) 
                     '***+*'   Find all files which have set Read-Only 
                               bits. 
                     '+**+*'   Find all files which have set Read-Only and 
                               Archive bits. 
                     '*++**'   Find all hidden subdirectories. 
                     '---+-'   Find all files which have only the 
                               Read-Only bit set. 
      nattrib   The new attribute mask which will be used to set the 
                attributes of each filespec found to match the target 
                mask.  The default mask is '*****' which means the 
                Archive, Directory, Hidden, Read-Only, and System bits 
                will not be changed.  The attributes in the mask are 
                positional dependant and in the alphabetical order 
                'ADHRS'. 
           Mask Options (New Atrribute Mask) 
                *         The specified attribute will not be changed. 
                +         The specified attribute will be set. 
                -         The specified attribute will be cleared. 
                Examples: (New Attribute Mask) 
                     '***+*'   Set the Read-Only bit on all files. 
                     '-**+*'   Set the Read-Only and clear the Archive 
                               bits of each file. 
                     '+*+++'   Set all attributes on all files, excluding 
                               directory attribute. 
                     '-----'   Clear all attribute on all files. 
                               Note:    You cannot set the directory bit 
                               on non-directory filespecs.  The attribute 
                               field which is displayed in the stem 
                               variable is that of the current attribute 
                               setting after any changes have been 
                               applied. 
 Purpose:  Finds all files which are equal to the specified filespec, and 
           places their descriptions (date time size attr filespec) in a 
           stem variable. 
 RC:       Return Codes 
      0         Successful. 
      2         Error.  Not enough memory. 

            Examples:
           
             /****<< Syntax Examples.>>***********************/
           
             /* Find all subdirectories on C: */
              call SysFileTree 'c:\*.*', 'file', 'SD'
           
             /* Find all Read-Only files */
              call SysFileTree 'c:\*.*', 'file', 'S', '***+*'
           
             /* Clear Archive and Read-Only bits of files which have them set */
              call SysFileTree 'c:\*.*', 'file', 'S', '+**+*', '-**-*'
           
           
             /****<< Sample Code and Output Example.>>********/
           
             /* Code */
              call SysFileTree 'c:\os2*.', 'file', 'B'
              do i=1 to file.0
                say file.i
              end
           
            /* Actual Output */
           12:15:89  12:00a        4096  A-HRS  C:\OS2LDR
           12:15:89  12:00a       29477  A-HRS  C:\OS2KRNL
            5:24:89   4:59p           0  -D---  C:\OS2
           
           
   

Inf-HTML End Run - Successful