Working on a query at the mo’ to read 2 lines from a file if it exists.
This is not a problem but it’s the folder structure that’s confusing me a little
Example:
I have the first part of the folder structure, let’s say D:\Folder1
Under folder 1 are multiple folders whose names I don’t know and each of these folder has a file in them that I want to read. The file name is the same under all these folders and the lines contain the same string value I can look for.
So as follows I would need to read 2 particular lines (if they exist) in the file (if it exists) under each of the unknown folders:
I’m making progress but just having an issue with files that don’t have the value I’m searching for in them. I want to return these as
This seems to work for some and not others, I think it’s dependant on whether the first file it hits has the value or not:
Q: (following texts of lasts "deflate_module " of lines whose (it as string as lowercase starts with "loadmodule deflate_module ") of ((files of folders of folders of folder “D:\websphere6\ihs1”) whose (name of it = “httpd.conf”)) as string as lowercase)
A:
modules/mod_deflate.so
modules/mod_deflate.so
modules/mod_deflate.so
So there may be for instance 8 of the “httpd.conf” files in 8 folder locations but I’m only getting the results for 3 of them (as abviously the other 5 don’t have the line I’m looking for)
How can I modify this query to return a result for all 8 files, but those without the line present display as “”? i.e:
modules/mod_deflate.so
modules/mod_deflate.so
modules/mod_deflate.so
etc…
I’ve tried an if/else if statement to return the value if it exists and return if it doesn’t but I can’t get this to work on more than one file.
(if (exists line whose (it as string as lowercase starts with "loadmodule deflate_module ") of it) then (following texts of lasts "deflate_module " of lines whose (it as string as lowercase starts with “loadmodule deflate_module “) of it) else (””)) of files whose (name of it as lowercase = “httpd.conf”) of folders of folders of folders “D:\websphere6\ihs1”