Parsing file.txt and if exist one of value in folder

Hello to all
im trying to parsing a txt file
q:lines of file"C:\file.txt"
A: blabla.exe
A: hora.exe
A: iconv.dll
T: 0.388 ms

after i need to check if one of the value what exist in the file.txt existing in the folder c:\test
q:exists file whose (name of it contains (lines of file"C:\file.txt")) of folder "c:\test"
E: A singular expression is required.
how can you see its not working… some 1 have idea how can i do this?
Thanks,
Julia

ok i found the way

q:(name of it) of files (lines of file “C:\file.txt”) of folder "c:\test"
A: two.jpg
A: 33866092.bat
A: skype.exe
T: 2.886 ms

3 Likes

This will not error out if the folder C:\test is missing, but otherwise the same:

names of files ( (it as trimmed string) of lines of files "C:\file.txt") of folders "c:\test"

nice thanks.
and if i wanna scan whole server, not only C:\ it can be d:\ or even more…? im trying "descendant of ", but its not realy working
q: (descendant folders of it) of files (lines of file “C:\file.txt”) of folder "c:\test"
E: The operator “descendant folders” is not defined.

This is a bad idea. Scanning the whole server like this will be very slow and will time out and will cause problems with the client being responsive.

This could be done in an action using relevance substitution or by running a script or a program to do this for you, and then save the results of the scan to a file.

If you limit your scope of search to very specific folders, then you might be able to do this relevance in an analysis property that only is evaluated once every 6 hours or less often, but even then it may never actually finish and return results if the scope is too wide.


This should be the relevance you are looking for:

descendants of folders "c:\test"

Hi jgstew!
this work perfect for me

q:(name of it) of files (lines of file “C:\file.txt”) of(descendant folders of folder "c:")

Now i need to find way for scaning all disks on the server, some kind of “if exist”

Julia

It is certainly possible to reference all the local fixed drives, but I agree with @jgstew and have to seriously caution against leveraging the ‘descendants’ inspector within an Analysis property or Fixlet, etc… (anything outside of an action) if the scope is wide (which it seems like it would be if you’re searching across multiple drives) since it will cause Client responsiveness issues along with potential resource issues on the endpoint itself.

1 Like

Hi Aram
i agree with you and with @jgstew , But im still curious how can i do it.

This will return all files on all drives. This is extremely slow and should definitely not be used on network drives. It usually fails and returns an class IllegalFileName error due to eventually hitting a file with a problematic name.

descendants of root folders of drives

This relevance took 84 seconds to successfully return all results on a very basic Windows 2012R2 server that has only single drive that happens to be one of the fastest SSDs in existence, the Intel 750. This could take hours on a spinning drive.


See related posts:

1 Like