FILELIST stage v1.2

Pipelines v1.9

 

Purpose, Operands, Streams used, Usage notes, Examples, See also

Home

 

Syntax

 
>>__ _FileList_ __ __________ __| Location |___________________________________________><
    |_FList____|  |_NOHeader_|
    |_ListFile_|
 
 
Location:
 
|__| Drive |__ ________ __| Path |__| Filename |__| Extension |_________________________|
              |_SUBdir_|
 
Drive:
 
    _DRIVE=current drive_____________
|__|_________________________________|__________________________________________________|
   |        (1)                      |
   |_ _DRIVE_ _=_ _*_________________|
     |_DRV___|   |_drive_____________|
                 |   <_;_____        |
                 |_(__drive__|__)____|
 
Path:
 
    _PATH=current directory__________
|__|_________________________________|__________________________________________________|
   |_PATH=_ _*_______________________|
           |_path____________________|
           |   <_;____               |
           |_(__path__|__)___________|
 
Filename:
 
    _FILE=*__________________________
|__|_________________________________|__________________________________________________|
   |        (1)                      |
   |_ _FILE__ _=_ _*_________________|
     |_RFILE_|   |_filename__________|
                 |   <_,________     |
                 |_(__filename__|__)_|
 
Extension:
 
    _EXT=*___________________________
|__|_________________________________|__________________________________________________|
   |       (1)                       |
   |_ _EXT__ _=_ _*__________________|
     |_REXT_|   |_extension__________|
                |   <_,_________     |
                |_(__extension__|__)_|
 
Notes: 
(1) Spaces are not allowed here.
 

Purpose

 

Use the FILELIST stage to search for disk files.

 

Without operands, the FILELIST stage searches for files in the current working directory.

 

With operands, you may specify a range of drives, paths, filename’s and file extensions through which FILELIST should search. In the path, file and extension operands, you may specify a pattern mask using the * and ? wildcard characters. When you wish to specify a list of operands, they must be separated by the specified character and enclosed in parentheses. Each time FILELIST finds a file which corresponds to the operands, it writes a record to its primary output stream which comprises, the size of the file in bytes; a ten digit right-aligned field with leading spaces, the date and time when the file was last modified, a seven byte attribute mask and the fully qualified path and name of the file.

 

If the primary input stream for the FILELIST stage contains any records, FILELIST copies the records from its primary input stream to its primary output stream.

 

Operands

 

    

NOHeader

Unless you specify the NOHeader operand; once the first file has been found which satisfies the specified search criteria; FILELIST writes a header record to the primary output stream, see: here for a description of the header record.

 

    

DRIVE=

DRV=

specifies a drive or list of semicolon separated drive’s enclosed in parentheses.

 

 

*

specifies that all drive’s connected to the machine are selected.

 

 

drive

is a target drive. If you specify a drive more than once, duplicate definitions are ignored.

 

    

SUBdir

instructs FILELIST to search subdirectories, once the target path has been located.

 

    

PATH=

specifies a directory path or list of semicolon separated directory path’s enclosed in parentheses. If you need to specify a path that contains a space or spaces then you must enclose the path in quotation (“) marks. If you do not specify the DRV= operand, then the PATH= operand specifies a subdirectory of the current working directory. Similarly, if you do not specify the PATH= operand, but you do specify the DRV= operand; FILELIST begins searching from the root directory of each specified drive. A null path is not allowed.

 

 

*

specifies that all directories are selected.

 

Path

is a target directory path. If you specify a path more than once, duplicate definitions are ignored.

 

    

FILE=

specifies a filename or list of comma separated filename’s enclosed in parentheses. If you need to specify a filename that contains a space or spaces then you must enclose the filename in quotation (“) marks. A null filename is not allowed.

 

    

RFILE=

specifies that filename is a regular expression or list of comma separated expressions enclosed in parentheses. If you need to specify an expression that contains a space or spaces, or if you specify a list of comma separated expressions; then you must enclose each expression in quotation (“) marks. A null expression is not allowed.

 

 

*

specifies that all filename’s are selected.

 

 

filename

is a target filename. If you specify a filename more than once, duplicate definitions are ignored.

 

    

EXT=

specifies a file extension or list of comma separated file extension’s enclosed in parentheses. If you need to specify a file extension that contains a space or spaces then you must enclose the extension in quotation (“) marks. A null extension is not allowed.

 

    

REXT=

specifies that extension is a regular expression or list of comma separated expressions enclosed in parentheses. If you need to specify an expression that contains a space or spaces, or if you specify a list of comma separated expressions; then you must enclose each expression in quotation (“) marks. A null expression is not allowed.

 

 

*

specifies that all file extension’s are selected.

 

 

extension

is a target file extension. If you specify an extension more than once, duplicate definitions are ignored.

 

Streams used

 

The following streams are used by the FILELIST stage:

 

Stream

Action

 

 

Primary output stream

FILELIST writes a record detailing each file that it finds to its primary output stream.

 

Usage notes

 

    1)

If the FILELIST stage discovers that its primary output stream is not connected, the FILELIST stage ends.

 

    2)

Each output record that FILELIST writes comprises; the size of the file in bytes; a ten digit right-aligned number with leading spaces, the date and time when the file was last modified, a seven byte attribute mask and the fully qualified path and name of the file.

 

The file attribute mask is a series of 0’s and 1’s that describe the attributes of the file. Each position in the mask identifies a particular attribute:

 

Byte 1 – N. a normal file (no other attributes apply)
     2 – R. read only
     3 – H. hidden
     4 – A. marked for archive
     5 – C. compressed
     6 – T. temporary
     7 – S. system

 

For example; the following header and record mask describes a read-only, compressed, system file:

 

Bytes      Date       Time     NRHACTS Filename
.......... yyyy/mm/dd hh:mm:ss 0100101 .......................

 

Note. the date is in the format: yyyy/mm/dd and the time is in twenty-four-hour format.

 

    3)

If you specify a drive letter that is not defined by the system, FILELIST issues an error message and then ends. However, if you specify a list of drive letters and one of them is the * character, FILELIST selects only those defined by the system and ignores all other specified drives.

 

    4)

When you want to search the root directory of the current drive and the current working directory is not the root, you should specify the DRV= operand with the current drive letter. The path is then relative to the root directory and not the current working directory.

 

    5)

FILELIST can be specified in any position where its primary output stream is connected.

 

    6)

FILELIST verifies that its primary input and secondary output streams are not connected and then begins execution.

 

Examples

 

In the following examples, the current working directory is:

 

C:\Myfiles>

 

    1)

To search for all the .txt files that begin with the character t on the root of drives C and D:

 

C:\Myfiles>pipe “filelist drv=(c;d) file=t* ext=txt | console

 

    2)

To search the current working directory for all the .txt and .exe files which are 5 characters long that begin with the letter t and end with the letter a.

 

C:\Myfiles>pipe “filelist file=t???a ext=(txt,exe) | console”

 

    3)

When FILELIST processes the PATH= operand, it considers leading and consecutive backslash (\) characters to represent a directory name. In the following example:

 

C:\Myfiles>pipe “filelist drv=d subdir path=\\Yourfiles | console”

 

the FILELIST stage argument expands to:

 
C:\Myfiles>pipe “filelist drv=d subdir path=*\*\Yourfiles | console”
 

The pipeline expects to find a directory called Yourfiles, at any level-2 (directory levels start at 0) sub-directory on drive D. When FILELIST encounters a directory named Yourfiles, it will write an output record for every file that it finds in that directory and its sub-directories.

 

    4)

To search for files on the root of a drive, (when it is not the current working directory) you must specify the DRV= operand. The following pipeline will display all the .txt files in the C drive root directory:

 

C:\Myfiles>pipe “filelist drv=c ext=txt | console”

 

    5)

To list every file on the machine:

 

C:\Myfiles>pipe “filelist drv=* subdir | console”

 

    6)

FILELIST verifies that its primary input and secondary output streams are not connected and then begins execution.

 

See also

 

Reference the following links for additional information:

 

>> (FILEAPPEND), < (FILEIN), > (FILEOUT)