Find line in multiple files

Hi everyone!

I have a question, i need to know if the line "sessionState cookieless=“UseCookies” " is in all the web config of IIS of my server. But i cant find a relevance who check all the config. If i use this relevance :
exists lines whose (it as lowercase contains "sessionstate" and it as lowercase contains "cookieless" and it as lowercase contains "usecookies") of file "D:\inetpub\wwwroot\PRUEBA\web.config"

i only have the result of one web config, i wanna know if its posible to know that of all the web config in the path D:\inetpub\wwwroot.
Thank you!

search in the files of the folders:

exists lines whose (it as lowercase contains "sessionstate" and it as lowercase contains "cookieless" and it as lowercase contains "usecookies") of files of folders of folder "D:\inetpub\wwwroot"

I’m afraid I don’t understand the question, there are several things you may be asking here. Can you clarify what kind of answer you want, and the conditions in which you want the answer?

Some of the things I can think of…

  • True if every directory contains a web.config and every web.config contains the string; False if any directory is missing a web.config or the web.config does not contain the string
  • True if every directory that contains a web.config contains the string, remain True if any directory has no web.config at all; False if any web.config is missing the string
  • A list of every directory, whether the directory contains a web.config, and whether the web.config has the string
  • A list of every directory where the web.config is missing the string
  • A list of every directory where the web.config is not present or does not contain the string

I will try that, thank you!

Sorry, my english maybe its not that good. What i need is the following:
I have 7 folders in wwwroot: App1 // App2 //…//App7 and each one has one web.config. I want to know if the string “UseCookies” is in each web.config. If its missing in anyone then false, otherwise true that its enough for me.
But if there any way that i can have the detailed of the string that will be a plus.

Thank you!

1 Like

You could use an xpath inspection for the same file in each folder. As an example

Q: (pathnames of it, xpaths "/configuration/system.web/sessionState/@cookieless" of xml documents of it as text) of (files "web.config" of folders of folder "C:\Inetpub\wwwroot")
A: C:\Inetpub\wwwroot\App1\web.config, UseCookies
A: C:\Inetpub\wwwroot\App2\web.config, AutoDetect
A: C:\Inetpub\wwwroot\App3\web.config, UseCookies
4 Likes