HI
I have a registry entry which contains a folder location.
I would like to use this value to check for the presence of a files or folder.
At present my relevance looks like this
exists descendants of folders {“Test” of key “HKLM\Software\WOW6432Node\InforIT” of native registry}
However I get error “This expression contained a character which is not allowed”.
Am I missing something is it even possible to do this.
Regards
Matt Gilder
The registry sub-query of your relevance statement should not be encapsulated in curly braces.
exists descendants of folders (“Test” of key “HKLM\Software\WOW6432Node\InforIT” of native registry)
This of course assumes that the registry sub-query returns valid results.
2 Likes
You’ll need to do a little bit of casting to string as well, and be sure to retrieve value “test” of key, not just “test” of key.
Try
exists descendants of folders (values "Test" of keys "HKLM\Software\WOW6432Node\InforIT" of native registry as string)
1 Like
Yep. I figured that out.
I get true if a folder or file exists in the directory. Which is progress.
However thinking about it I only really care if there is a file in the root directory or a file in any sub directory under the root folder.
I did try using exists (descendants of (files it;folder it ) but that returns true even if there is a file in the root directory or just an empty subfolder.
Any ideas?
exists descendants of folders()
Should do it I think.
descendants
only returns files; descendant folders
is separate.
2 Likes
Or do you mean you don’t want to recurse every level, and only care if files exist in the top-level or one level beneath?
exists files of (it; folders of it) of folders ()
1 Like
Excellent exists descendants of folders() did the trick.
I just wanted to see if file(s) existed under the root directory regardless of how deep there where down the tree.
1 Like