Searching files for a line containing

(imported topic written by Don65)

Attempting to create a relevance clause that will search a folder for files with a specific extension and return true or false depending on whether any of the files contain a specific line. I anticpate the folders to be searched will only have a few small files.

I’ve come up with the following two relevancy clauses, however, having some challenges putting them together. Any assistance would be greatly appreciated.

The following checks for the existence of files with a specific extension. This returns a list of the files located in the folder.

(it as lowercase) whose (it contains “.txt”) of names of descendants of folder “C:\test1”

The following checks a file for a line containing text. This will only check one file, however, needs to check multiple files.

exists line containing “AutoReconnect=Y” of file “C:\test1\test.txt”

Any assistance greatly appreciated.

(imported comment written by NoahSalzman)

This is one way to do it. This works if the total size of the concatenated files stays small:

(it contains “AutoReconnect=Y”) of concatenation of lines of files whose (name of it contains “.txt”) of folder “c:\some_folder”

(imported comment written by Don65)

Excellent and I very much appreciate the assist. Wondering if it might be possible to take it one step further.

During testing, it appears the relevancy below looks for the files three folders deep in c:\users**

(it contains “AutoReconnect=Y”) of concatenation of lines of files whose (name of it contains “.txt”) of (folders of folders of folder “c:\temp”)

Wondering if it might be possible to look for files in c:\users*\desktop - Essentially three folders deep with the first folder named “users”, the second folder a wild card, and the third folder named “desktop”

(imported comment written by SystemAdmin)

You need to add an extra filter element after the ‘folders’ function that you want to modify.

… of (folders of folders of folder “c:\temp”)

… of (folders whose (name of it contains “Desktop”) of folders of folder “c:\temp”)

(imported comment written by jessewk)

this will return all desktop folders in the path “c:\users*” :

folders “desktop” of folders of folder “c:\users”