filesexist

Table of Contents

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.

Arguments:

  • list: string, 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