I have directory called 'scenarios' as part of my installation. Amongst the directories within the scenarios directory, there is one called 'user'. When users run my app after installation, they may generate data in any of the sub-directories contained within scenarios including the user directory. When uninstalling, I want to be able to delete all of the sub-directories (and their contents) under scenarios EXCEPT for 'user'. I try to do this with the following action prior to creating the uninstaller:

<addDirectoriesToUninstaller>
    <addContents>1</addContents>
    <excludeFiles>^.*/user$</excludeFiles>
    <files>${installdir}/scenarios</files>
</addDirectoriesToUninstaller>

Despite having this action, ${installdir}/scenarios/user is still deleted. What am I doing wrong?

asked 11 Jul '12, 18:26

jalexrod's gravatar image

jalexrod
38121215
accept rate: 0%

I have also tried adding a removeFilesFromUninstaller option for ${installdir}/scenarios/user as follows, but this does not work either:

<removeFilesFromUninstaller>
    <files>${installdir}/scenarios/user/*</files>
    <matchHiddenFiles>1</matchHiddenFiles>
</removeFilesFromUninstaller>
(11 Jul '12, 18:36) jalexrod

I believe the best solution is to first remove the "user" directory after it is created by the installer:

<removeFilesFromUninstaller>
    <files>${installdir}/scenarios/user/*</files>
    <matchHiddenFiles>1</matchHiddenFiles>
</removeFilesFromUninstaller>

And then delete the scenarios folder in the <postUninstallationActionList> excluding the user directory:

<postUninstallationActionList>
    <deleteFile>
       <path>${installer}/scenarios/*</path>
        <excludeFiles>*/user</excludeFiles>
    </deleteFile>
</postUninstallationActionList>
link

answered 15 Jul '12, 15:05

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

This works for me, thanks!

(18 Jul '12, 14:36) jalexrod
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×33
×14
×3

Asked: 11 Jul '12, 18:26

Seen: 1,491 times

Last updated: 18 Jul '12, 14:36