File search with multiple versions names

(imported topic written by jpeppers91)

I want to search two directories for a config file that has the name “london” in it? There are various versions of the file name but “london” is consistent among all of them. How would I do that?

(imported comment written by Lee Wei)

Something like this?

q: names whose (it as lowercase contains “london”) of files of folder “c:\temp\test1”

A: londonver1

A: londonver2

A: some file london ver3

Please correct me if I misunderstand the question.

Lee Wei

(imported comment written by jpeppers91)

How do I look in 2 separate paths

C:temp and E:\temp

(imported comment written by Lee Wei)

Here is one idea:

q: names whose (it as lowercase contains “london”) of (files of folder “c:\temp\test1”; files of folder “c:\temp\test2”)

A: londonver1

A: londonver2

A: some file london ver3

A: my london file.txt

(imported comment written by jpeppers91)

I’m not getting any hits on the modified relevance.

(imported comment written by sthull)

Are the files in C:\temp and E:\temp directly or are they in subfolders under those directories?

(imported comment written by jpeppers91)

directly under that path.

(imported comment written by sthull)

The relevance is valid then. Can you double-check what you ran for syntax errors?

You can also run the following to see everything and verify that “london” is in one of the names:

q: names of (files of folder “c:\temp”; files of folder “e:\temp”)

(imported comment written by Lee Wei)

jpeppers,

Maybe you can show us the actual statement used. Just in case we can spot something different.

Lee Wei

(imported comment written by jpeppers91)

names whose (it as lowercase contains “london”) of (files of folder “C:\Program Files\VPN 3000\Profiles”; files of folder “C:\Program Files\Cisco Systems\VPN Client\Profiles”)

(imported comment written by sthull)

The syntax looks good, but it does assume that both folders exist. Are you getting an error back when you run it, or just no results? What do you get when you query for all names without the ‘whose’ clause?

Steve

(imported comment written by jpeppers91)

Still receiving error status. I think I’ll just use 2 separate properties.

(imported comment written by sthull)

It sounds like one or both folders definitely don’t exist, so you would need to use something like this to have one property:

q: if exists folder “C:\Program Files\VPN 3000\Profiles” then names whose (it as lowercase contains “london”) of files of folder “C:\Program Files\VPN 3000\Profiles” else if exists folder “C:\Program Files\Cisco Systems\VPN Client\Profiles” then names whose (it as lowercase contains “london”) of files of folder “C:\Program Files\Cisco Systems\VPN Client\Profiles” else error “file not found”

(imported comment written by jessewk)

Try this:

names whose (it as lowercase contains “london”) of files of folders (“C:\Program Files\VPN 3000\Profiles”; “C:\Program Files\Cisco Systems\VPN Client\Profiles”)

(imported comment written by SystemAdmin)

Along the same lines as posted above. I’m trying to check for a line of text in two different files. Following the above relevance this should work: can someone take a look at this for me please:

Q: IF exists lines whose (it as lowercase contains “company enterprise root”) of file ("/Library/Keychains/System.keychain"; “/Library/Keychains/x509anchors”) THEN (“Certificate Installed”) ELSE (“Not Installed”)

(imported comment written by Lee Wei)

What is the error that you are getting?

Trying changing “file” to “files” so that if the files do not exist, it should still work.

(imported comment written by SystemAdmin)

There’s no error, just not returning the correct results. The x509anchors files has the text “company enterprise root” in it, the results from the Anaysis is saying “Not Installed”.

(imported comment written by NoahSalzman)

This works for me. Two of those files exist, one does not (just as a test). One of the files does indeed contain “APPLE ROOT”.

Q: IF exists lines whose (it as lowercase contains “apple root”) of files ("/Library/Keychains/System.keychain"; “/Library/Keychains/x509anchors”; “/Library/foo”) THEN (“Certificate Installed”) ELSE (“Not Installed”)

A: Certificate Installed

(imported comment written by NoahSalzman)

Also, make sure that you are spelling/capitalizing/pathing your x509anchor file exactly as it exists on your target systems. Some googling shows that it may live in a different spot and have a capital X.

(imported comment written by SystemAdmin)

That did it. Our text OS image was different from the OS out in the field.

Thank you guys/gays