brettparkhurst
Enthusiast
Enthusiast

Clean directory before installing

Is there an option for the installer to clean a directory before it installs over it again?  We want to clean-up directories before running new versions of the installer over the top of the existing install.

0 Kudos
4 Replies
michieldhont_
Enthusiast
Enthusiast

Hi @brettparkhurst ,

You can use <deleteFile> with a wildcard to delete files and folders:

<readyToInstallActionList>
<deleteFile>
<path>/path/to/directory/*.txt</path> </deleteFile>
<readyToInstallActionList>

Regards,

Michiel

0 Kudos
brettparkhurst
Enthusiast
Enthusiast

This is good, but I want to clean the entire directory including any subdirectories that may have been created outside of the installation.

0 Kudos
michieldhont_
Enthusiast
Enthusiast

Hi @brettparkhurst,

In that case it might be a better idea to run the uninstaller of the existing installation in unattended mode. In that way you can be sure the previous installation is completely removed:

<runProgram>
   <program>.\uninstall.exe></program>
   <programArguments>--mode unattended</programArguments>
   <workingDirectory>${installdir}</workingDirectory>
</runProgram>

You could add the action in a <showProgressDialog> action to show the user what the installer is doing.

<showProgressDialog>
  <title>Uninstalling ${value}</title>
  <actionList>
     <runProgram>
       <program>${uninstallCmd}</program>
         <programArguments>--mode unattended</programArguments>
       </runProgram>
    </actionList>
</showProgressDialog>

 Best regards,

Michiel

0 Kudos
brettparkhurst
Enthusiast
Enthusiast

So there is no way to delete a directory and all subdirectories?  I am surprised this is not an option as this is something that happens quite a bit.  Files and directories created within the install directory that are not part of the original install.  We just want them cleaned up before we upgrade.

0 Kudos