Prototype: filesexist(list)

Return type: boolean

Description: Returns whether all the files in list can be accessed.

All files must exist, and the user must have access permissions to them for this function to return true.

[This function can accept many types of data parameters.][Functions#collecting functions]

Arguments:

  • list : The name of the list variable or data container to check, in the range [a-zA-Z0-9_$(){}\[\].:]+

Example:

body common control

{
      bundlesequence  => { "example" };
}

bundle agent example

{
  vars:

      "mylist" slist => { "/tmp/a", "/tmp/b", "/tmp/c" };

  classes:

      "exists" expression => filesexist("@(mylist)");

  reports:

    exists::

      "All files exist";

    !exists::

      "Not all files exist";
}

Output:

R: Not all files exist

History: The [collecting function][Functions#collecting functions] behavior was added in 3.12.

See also: [About collecting functions][Functions#collecting functions], grep(), every(), some(), and none().