Filename wildcard search

In relevance is there a non-regex way to search for a filename wildcard like this where one has a full path but others contain a wildcard ‘search’ ?

...files ("/etc/blah.cf";"/etc/mail/*.cf")

Is it that the path contains the wildcard or just the filename?

If it is the filename you could just do

files whose it as string contains “.cf” of folder /etc/mail

If the path contains wildcard then it requires a lot more computing power and you would want to do something with the ancestors inspector

Searching for files is a bit expensive to add to your BigFix client loop. I might suggest you use an Action to perform the search and then relevance to read the results of the search, similar to this post:

Or, if the folders are limited, you could use a plural folder construction.

q: files whose (name of it as lowercase ends with ".cf") of folders ("/etc";"/etc/mail")

Or, since you wanted blah specifically, you can also create a plural file object like this:
q: ((files whose (name of it as lowercase ends with ".cf") of folders ("/etc/mail"));(file "/etc/blah.cf"))

1 Like

with the goal of identifying configured SMTP servers, I found this to work for me pretty well:

(pathname of it, (following text of first "=" of lines whose (it as string as lowercase starts with "relayhost") of it)|(following text of first "DS" of lines whose (it as string as lowercase starts with "ds") of it)|line whose (it as string as lowercase contains "mailhost")of it as trimmed string) of files whose ((name of it as lowercase ends with ".cf" AND exists line whose (it as string as lowercase starts with "relayhost" OR it as string as lowercase starts with "ds")of it) OR (name of it = "hosts" AND exists line whose (it as string as lowercase contains "mailhost")of it)) of folders ("/etc/postfix";"/etc/mail";"/etc")

1 Like