Exists Multiple Files Returns False

This is a simple example, the real one has 11 files, but the results are confusingly the same: It evaluates False even though both files and directory exist (I’ve tried “file” and “files” as well). Running the command on one file at a time returns true. My goal was to return true if all files existed but is this logic looking for a single file whose name is both?

exist file whose (name of it = "OffScrub_O16msi.vbs" and name of it = "OffScrub_O15msi.vbs") of folder "c:\temp\office365\"

A single file cannot have both names which is what this test is saying.

Thanks. I think I saw that when I looked at it more closely. OR would work. Any suggestions for ensuring that all 11 files exist or does it get messy?

1 Like

I don’t have a debugger handy but think you could try

not exists folder "c:\temp\office365" whose (set of (names of files of it as lowercase) contains set of ("file1.vbs";"file2.vbs";"file3.vbs"))

Or maybe exists folder... depending on which check you want.

Just remember that the bracketed part of a “whose” gets an individual item passed into it like a for loop, not all the items. So as it goes through the loop it is only looking at one file at a time in your case.

Thanks. I’ll play around with it. Maybe I’ll forgo that particular relevance check.

You can use the conjunction of (relevance clause 1;relevance clause 2; relevance clause 3;…) to check that all files are found.