_file - UDM Built-in Variable


The _file built-in variable contains the name of the file for the current iteration in a forfiles loop. _file also has special attributes, as shown in the following table.

For information on using _file and its special attributes, see _file Variable Attributes.

Note

_file cannot be set using the set command.

 

Attribute Name

Description

accessdate

Date on which the file was last accessed.
 
Format (ISO 8601) is yyyy-mm-dd.

accesstime

Time when the file was last accessed.
 
The default format (ISO 860) is hh:mm:ss. If the msecs parameter is added to the forfiles statement, the format is hh:mm:ss.nnn, where .nnn is a millisecond value. If the file system does not capture the millisecond portion of a file time, .000 is used.

accesstimestamp

Combination of accessdate and accesstime: yyyy-mm-dd hh:mm:ss[.nnn].
 
If the file does not have an access time, but does have a access date, 00:00:00 is used for the time portion. The millisecond portion (.nnn) of the timestamp value is displayed only for supported platforms when msecs=yes is added to the forfiles statement.

createdate

Date on which the file was created.
 
Format (ISO 8601) format of yyyy-mm-dd.
 

Note

Creation dates and times are guaranteed to be reliable only on Windows. The value returned for this attribute on UNIX systems reflects the file's most recent status change on the file system. Such changes include - but are not limited to - ownership changes, permissions changes, and content changes. This means that the value returned in this attribute will be the actual create date/time only if the file and its properties have not changed since it was created. (For more information on the times recorded for files, refer to documentation for the UNIX stat command.)

createtime

Time when the file was created.
 
The default format (ISO 860) is hh:mm:ss. If the msecs parameter is added to the forfiles statement, the format is hh:mm:ss.nnn, where .nnn is a millisecond value. If the file system does not capture the millisecond portion of a file time, .000 is used.
 

Note

Creation dates and times are guaranteed to be reliable only on Windows. The value returned for this attribute on UNIX systems reflects the file's most recent status change on the file system. Such changes include - but are not limited to - ownership changes, permissions changes, and content changes. This means that the value returned in this attribute will be the actual create date/time only if the file and its properties have not changed since it was created. (For more information on the times recorded for files, refer to documentation for the UNIX stat command.)

createtimestamp

Combination of createdate and createtime: yyyy-mm-dd hh:mm:ss[.nnn].
 
If the file does not have a creation time, but does have a creation date, 00:00:00 is used for the time portion. The millisecond portion (.nnn) of the timestamp value is displayed only for supported platforms when msecs=yes is added to the forfiles statement.
 

Note

Creation dates and times are guaranteed to be reliable only on Windows. The value returned for this attribute on UNIX systems reflects the file's most recent status change on the file system. Such changes include - but are not limited to - ownership changes, permissions changes, and content changes. This means that the value returned in this attribute will be the actual create date/time only if the file and its properties have not changed since it was created. (For more information on the times recorded for files, refer to documentation for the UNIX stat command.)

moddate

Date on which the file was last modified (referenced for z/OS).
 
Format (ISO 8601) is yyyy-mm-dd.

modtime

Time when the file was last modified (referenced for z/OS).
 
The default format (ISO 860) is hh:mm:ss. If the msecs parameter is added to the forfiles statement, the format is hh:mm:ss.nnn, where .nnn is a millisecond value. If the file system does not capture the millisecond portion of a file time, .000 is used.

modtimestamp

Combination of moddate and modtime: yyyy-mm-dd hh:mm:ss[.nnn].
 
If the file does not have a modification time, but does have a modification date, 00:00:00 is used for the time portion. The millisecond portion (.nnn) of the timestamp value is displayed only for supported platforms when msecs=yes is added to the forfiles statement.

name

Name of the file (same as referencing _file itself without any attributes).

size

Size of the file (in bytes).

type

Type of file. Values are:

type has meaning in a forfiles statement under IBM i in the LIB file system:

  • If the value of _file.type is directory, the file type is a Physical file.
  • If the value of _file.type is file, the file type is a Save file.