VMware Cloud Community
brettparkhurst
Enthusiast
Enthusiast
Jump to solution

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.

Reply
0 Kudos
1 Solution

Accepted Solutions
michieldhont_
Hot Shot
Hot Shot
Jump to solution

Hi @brettparkhurst,

Yes it is possible to delete an entire directory using <deleteFile>:

 

<deleteFile>
  <path>/path/to/directory/</path>
</deleteFile>

 

Regards,

Michiel 

 

View solution in original post

Reply
0 Kudos
5 Replies
michieldhont_
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
brettparkhurst
Enthusiast
Enthusiast
Jump to solution

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

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot
Jump to solution

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

Reply
0 Kudos
brettparkhurst
Enthusiast
Enthusiast
Jump to solution

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.

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot
Jump to solution

Hi @brettparkhurst,

Yes it is possible to delete an entire directory using <deleteFile>:

 

<deleteFile>
  <path>/path/to/directory/</path>
</deleteFile>

 

Regards,

Michiel 

 

Reply
0 Kudos