Returns information about a file.


fileinfo(path, attribute, [, optional])


The path of the file (a string).
The attribute being queried (a string).
[, optional]
An optional parameter (a string).


Templex Expression Result
{ fileinfo("e:/demos/angacc.dat", "modified"), %i } 1189688565
{ fileinfo("e:/demos/angacc.dat", "rootname")} angacc
{ fileinfo("e:/demos/angacc.dat", "filename")} angacc.dat
{ fileinfo("e:/demos/angacc.dat", "dirname") } e:/demos
{ fileinfo("e:/project/doe/variant1/run7/angacc.dat", "dir1") } run7
{ fileinfo("e:/project/doe/variant1/run7/angacc.dat", "dir2") } variant1
{ fileinfo("e:/project/doe/variant1/run7/angacc.dat", "dir3") } doe
{ fileinfo("e:/demos/angacc.dat", "contains", "0"), %i } 94576
{ fileinfo("e:/demos/angacc.dat", "contains", "[Ee][Rr][Rr][Oo][Rr]"), %i } integer


This function supports querying several attributes. These include: “created”, “modified”, or “accessed”, which return the time (expressed in seconds since January 1st, 1970) that the file was created or last modified or accessed, respectively. You can also query the file’s size in bytes (via “size”), determine which directory the file resides in (via “dirname”) or what the file’s name is when stripped of directory information (via “filename”). Finally, this function counts the instances of a regular expression (defined by the optional string parameter) found in the file.

The function facilitates generating metrics about files, especially solver output files referenced by HyperStudy.

Note: This function only works when the file exists.