cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ggrewe
Level 5

Conditional Install if a file exists

I have been struggling with this one a little bit. What would be the correct syntax for a condition NOT to install a component if a particular file already exists in the System Folder?
Labels (1)
0 Kudos
(9) Replies
RobertDickau
Flexera Alumni

If you have a system search that sets FOUND_THE_FILE if the file exists, you can use Not FOUND_THE_FILE to detect that the file is absent.
0 Kudos
ggrewe
Level 5

RobertDickau,

I have searched Help for "FOUND_THE_FILE" and the response is "No Topics Found". Can you tell me what this is and how to use it?
0 Kudos
RobertDickau
Flexera Alumni

When you set up a system search (in the System Search view), you give MSI the name of a public property (one with an all-caps name) to fill in if the file is found. FOUND_THE_FILE was just an example; you can pick any property (say, MYPROP) you want, and then use Not MYPROP as the negation...
0 Kudos
fred86
Level 3

hi,
I tried to create a "new feature" -> create "new component" -> add some files to the component and then set the condition to "Not FOUND_FILE". Also I createt a system search which searches for the file "test.txt" and if the file is found write what ever in the "FOUND_FILE" property.
Before this I createt the property "FOUND FILE" by using "Property Manager -> New Property".

But it dosen't work. Is that the way you meant robert? Could you be so polite to describe more details?
Thank you very much indeed.
0 Kudos
RobertDickau
Flexera Alumni

The steps you listed sound correct: create a system search that populates FOUND_FILE, create a component with condition "Not FOUND_FILE".

It's not necessary to create FOUND_FILE beforehand, so you might delete that from the Property Manager view; as a test, if you place a text field containing [FOUND_FILE] on the InstallWelcome dialog box, does it appear that the search succeeds?
0 Kudos
fred86
Level 3

I tried both, to create the property "FOUND_FILE" and not to create it. Nothing worked.

I just put a text object on the InstallWelcome dialog. But nothing appears in it, as if the search didn't start or something. I'm going mad 😞
0 Kudos
RobertDickau
Flexera Alumni

Don't go mad yet --- what are your system search settings? Perhaps try a simple search first (look for notepad.exe in [WindowsFolder] and see what the search property contains afterward) to get the feel of it?
0 Kudos
fred86
Level 3

Strewth! I found my mistake. I tried to find a test.txt but didn't recognize that file extentions where disabled, so the file was text.txt.txt, stupid me! So thank you very very much robert. Everything works as it should.
0 Kudos
RobertDickau
Flexera Alumni

I'm glad it turned out to be something simple---thanks for posting the resolution!
0 Kudos