Concatenate multiple results

(imported topic written by nberger91)

brain ache on this relativey simple relevance, need help if possible …

i need to be able to return multiple results, the following example halts after the first file detected.

i also need a way to add some error checking for name, size, modification time, pathname incase none of those attributes exists on a file?

Any help appreciated.

Single query

q: if exists file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & size of it as string & " | " & modification time of it as string & " | " & pathname of it as string) of file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else “N/A”

A: BESClientUI.exe | 1472448 | Fri, 27 Jul 2012 00:53:18 +0000 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.EXE

T: 0.464 ms

single query

q: if exists file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & size of it as string & " | " & modification time of it as string & " | " & pathname of it as string) of file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else “N/A”

A: BESClient.exe | 4792768 | Fri, 27 Jul 2012 00:53:18 +0000 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClient.EXE

T: 0.461 ms

joined (which fails)

q: if exists file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & size of it as string & " | " & modification time of it as string & " | " & pathname of it as string) of file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else if exists file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & size of it as string & " | " & modification time of it as string & " | " & pathname of it as string) of file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else “N/A”

A: BESClientUI.exe | 1472448 | Fri, 27 Jul 2012 00:53:18 +0000 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.EXE

T: 0.433 ms

(imported comment written by nberger91)

making progress, but still need help with returning multiple results please

q: if exists file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & (if (exists version block 1 of it and exists value “FileDescription” of version block 1 of it) then (value “FileDescription” of version block 1 of it) else (“Unknown”)) & " | " & (if (exists version block 1 of it and exists value “FileVersion” of version block 1 of it) then (value “FileVersion” of version block 1 of it) else (“Unknown”))& " | " & (if (exists size of it) then (size of it as string) else (“Unknown”)) & " | " & (if (exists modification time of it) then (modification time of it as string) else (“Unknown”))& " | " & (if (exists pathname of it) then (pathname of it as string) else (“Unknown”))) of file “BESClientUI.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else “N/A”

A: BESClientUI.exe | Tivoli Endpoint Manager Client User Interface | 8.2.1310.0 | 1472448 | Fri, 27 Jul 2012 00:53:18 +0000 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.EXE

T: 1.647 ms

q:if exists file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) then (name of it & " | " & (if (exists version block 1 of it and exists value “FileDescription” of version block 1 of it) then (value “FileDescription” of version block 1 of it) else (“Unknown”)) & " | " & (if (exists version block 1 of it and exists value “FileVersion” of version block 1 of it) then (value “FileVersion” of version block 1 of it) else (“Unknown”))& " | " & (if (exists size of it) then (size of it as string) else (“Unknown”)) & " | " & (if (exists modification time of it) then (modification time of it as string) else (“Unknown”))& " | " & (if (exists pathname of it) then (pathname of it as string) else (“Unknown”))) of file “BESClient.EXE” of folder “BigFix Enterprise\BES Client” of folder (value of variable “ProgramFiles” of environment) as string else “N/A”

A: BESClient.exe | Tivoli Endpoint Manager Agent | 8.2.1310.0 | 4792768 | Fri, 27 Jul 2012 00:53:18 +0000 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClient.EXE

T: 1.700 ms

(imported comment written by SystemAdmin)

Not sure what your final desire might be but you do know you can just have the application inspector pump out a lot of that information for you? Going after the version blocks as you are isn’t needed.

q: application “C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.exe”

A: “BESClientUI.exe” “8.2.1364.0” “IBM Endpoint Manager Client User Interface” “8.2.1364.0” “IBM Corp.”

And this would probably be much simpler (with some sample values):

q: (it as string & " | " & size of it as string & " | " & pathname of it & " | " & modification time of it as string) of application “C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.exe”

A: “BESClientUI.exe” “8.2.1364.0” “IBM Endpoint Manager Client User Interface” “8.2.1364.0” “IBM Corp.” | 12345678 | C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.exe | Wed, 13 Feb 2013 17:28:20 -0800

(imported comment written by jeremylam)

You can combine the two file checks with plural inspectors and use the “|” operation to check for errors:

q: (name of it & "|" & ((size of it as string) | "ERR") & "|" &((modification time of it as string) | "ERR" ) & "|" & pathname of it) of files ("BESClientUI.exe"; "BESClient.exe") of folder "BigFix Enterprise\BES Client" of folder (value of variable "ProgramFiles" of environment) as string
A: BESClientUI.exe|1471896|Mon, 05 Dec 2011 18:49:22 -0800|C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClientUI.exe
A: BESClient.exe|4678552|Mon, 05 Dec 2011 18:49:22 -0800|C:\Program Files (x86)\BigFix Enterprise\BES Client\BESClient.exe