PWB Extensions Help (ext.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ForFile
                                             Up Contents Index Back
─────PWB Extensions─────────────────────────────────────────────────────────
 
  Syntax:  int ForFile( char far *pattern, int attribute,
                        void (pascal EXPORT *routine)(char far *) );
 
  Returns: True if files are found, otherwise false.
 
  See:     GetListEntry, ScanList, SelectFiles, Using Files
 
     ForFile allows an extension to perform an operation on all files
     that match a wildcard specification and file attribute.
 
     Argument       Description
 
     <pattern>      A string specifying a file or group of files, using
                    the wildcard patterns recognized by MS-DOS.
 
     <attribute>    Attributes of files to be matched. The following
                    constants can be combined by using the bitwise OR
                    operator (|):
 
                    Constant       Attribute
 
                    FORFILE_RO     Read-only files
                    FORFILE_H      Hidden files
                    FORFILE_S      System files
                    FORFILE_V      Volumes
                    FORFILE_D      Directories
                    FORFILE_A      Archive files
 
                    Note that volume labels are not matched by MS-DOS.
                    The FORFILE_V attribute has no effect.
 
                    The following constants are provided for commonly
                    used combinations of attributes:
 
                    Constant        Attribute
 
                    FORFILE_MOD     Any modifiable file
                    FORFILE_ALL     Any file
 
     <routine>      A function to be called for each matching file. You
                    must define this function in your extension. It must
                    have the following type and arguments:
 
                         void _pascal EXPORT Func( char far *filename );
 
                    PWB passes the file name of each matching file in
                    turn. Your function can use <FileName> to do
                    operations such as opening, reading, writing, or
                    searching the file.
                                    -♦-