/build/static/layout/Breadcrumb_cap_w.png

Delete Folders after uninstall

When uninstalling the App my msi leaves a folder behind and i wanna know if there is any other way of deleting that folder instead of writing a Vbscript in custom actions?

0 Comments   [ + ] Show comments

Answers (11)

Posted by: anonymous_9363 16 years ago
Red Belt
0
I suspect that this is because the application is creating files in that folder that your MSI didn't include. It should be obvious that an uninstaller won't, by default, remove objects which it didn't install. You could try creating and installing a 'dummy' file which hopefully the app would overwrite. Not all apps are happy about that, though. Alternatively, your authoring tool should have an option to remove files on uninstall. Finally, if it doesn't, you need to manipulate entries in the RemoveFiles table.
Posted by: AngelD 16 years ago
Red Belt
0
If this left behind folder is an empty folder then add it using the CreateFolder table and it will be removed during uninstall (if it's empty).
Otherwise you will have to use the RemoveFile table as Ian suggested or have a custom action removing the folder and its content.
Posted by: Coriolus 16 years ago
Orange Belt
0
You could also create a simple custom action to force the removal of the directory upon uninstall only.
Posted by: fsubzwari 16 years ago
Senior Yellow Belt
0
I would suggest creating a custom action. use this vbscript.

dim filesys, folder1
set filesys = CreateObject ("Scripting.FileSystemObject")
set folder1 = filesys.GetFolder("c:\program files\APPNAME\")
folder1.Delete

G[:)][:)]DLuck!
Posted by: chichora2003 16 years ago
Orange Belt
0
i get this error after uninstalling

ERROR 1720 : There is a problem with this windows installer package. A script is required for this install to complete could not be run. Custom action deleting folder script error , Microsoft VBScript runtime error.Path not found Line 3 , Column 1.

This is how my custom action looks like

dim filesys, folder1
set filesys = CreateObject ("Scripting.FileSystemObject")
set folder1 = filesys.GetFolder("c:\program files\APPNAME\")
folder1.Delete

Install exec seq= AfterInstallFinalize
InstallExec Cond=REMOVE="ALL"
Posted by: AngelD 16 years ago
Red Belt
0
As the error states, the directory path could not be found.
So if the directory exist you would use the bellow instead without the trailing '\'
set folder1 = filesys.GetFolder("c:\program files\APPNAME")

When you get the code working add
On Error Resume Next
Posted by: anonymous_9363 16 years ago
Red Belt
0
One of the problems with using properties in CAs is that paths are resolved with trailing backslash but many tools don't like them. If you're using a property to determine the folder name, you'll need tp add some code to strip the trailing backslash. Make sure you test for one first, though!
Posted by: chichora2003 16 years ago
Orange Belt
0
Hi Coriolus

Can you tell me what should i put in the custom action ?
Posted by: chichora2003 16 years ago
Orange Belt
0
Angel i 've tried without the backslash it doesn't work still same error . Can some of you guyz tell me how to do the CreateFolder technique in the table?

Thanks guys
Posted by: AngelD 16 years ago
Red Belt
0
Here is an example for the "C:\Program Files\MY PACKAGE\EMPTY" directory
Replace "{C506A086-DBD1-4936-8DA2-E9BF08F27A1E}" with your own Component GUID (ComponentId column)

Component table
Component ComponentId Directory_ Attributes Condition KeyPath
CreateFolder {C506A086-DBD1-4936-8DA2-E9BF08F27A1E} EMPTY 0

CreateFolder table
Directory_ Component_
EMPTY CreateFolder

Directory table
Directory Directory_Parent DefaultDir
INSTALLDIR ProgramFilesFolder MYPACK~1|MY PACKAGE
EMPTY INSTALLDIR EMPTY

FeatureComponents table
Feature_ Component_
Complete CreateFolder
Posted by: danr29 16 years ago
Purple Belt
0
Did you try moving your CA up in the sequence order? Preferably right before InstallFinalize instead of after?
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ