Compare folder contents

(imported topic written by sinucus)

I am looking for a way to validate that a folder contains certain files. It doesn’t have to be specific, just file names is all I need. I have a list of all the sha1 files that should be on the server. I want to compare that to a .txt file and make sure that all the files are there. What is the best way to do this?

exists file c:\wwwrootbes\329048203948 OR exists file c:\wwwrootbes\2389csdf9023 OR etc… 475 times?

Or something like exists files of folder c:\wwwrootbes\ of lines of files.txt?

On a side note, is there a way to query the wwwrootbes\sha1 folder location is other than asking “value “wwwrootfolder” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\BigFix\Enterprise Server” of registry as folder”?

The summary is, I have a remote Tivoli server and I want to make sure that it has all of the sha1 files in it’s sha1 folder that it needs to patch. How can I do a Relevance query to validate this? It cannot be an action, it’s part of the relevance of a fixlet.


(imported comment written by BenKus)

By any chance does this BigFix Labs product meet your needs?


(imported comment written by sinucus)

I don’t believe so. I looked around that tool a few weeks ago when I saw the announcement. My issue stems from the fact that I’m using external sites and the fixlets are imported so they have no relationship to the site. I believe that the (not exists file) 475 times would solve my problem but I’m afraid of how inefficient that is and how long it will take me to create/update the relevancy.

I thought I’ve seen code that iterated through lines of a file and that I would think would be the most efficient as it could take use of “it”. I tried for a few hours looking for code samples but I was unable to locate anything.


(imported comment written by sinucus)

I found another post which lead me to a solution

(number of (name of files of folder ((value “wwwrootfolder” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\BigFix\Enterprise Server” of registry as string) & “bfmirror\downloads\sha1”)) whose ((content of file “c:\files.txt”) does not contain (it)) != 0) OR not exists file “c:\files.txt”

This reads the files.txt and compares it against the sha1 folder. If they match it returns 0, if they differ they return a value != 0 which turns on my relevance.