Removing everything from the TARGETDIR on uninstall

Got a problem you cannot solve? Try here.
Post Reply
Gareth Owen
Posts: 149
Joined: Fri Oct 21, 2005 8:42 am
Location: UK

Removing everything from the TARGETDIR on uninstall

Post by Gareth Owen »

Is there a way to remove the ENTIRE TARGETDIR when uninstalling an application.

In this case it is a MATLAB application, which creates all sorts of subdirectories under the installation directory when you run it the first time.

I want to be able to completely remove the directory tree, otherwise all sorts of files will get left behind,
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

As I think you already know, the Delete Files command is available, but it deletes single level folders only.

You may want to try the Find All Files command and code a loop which processes each found file and calls the DeleteFileA Win32 API in kernel32.dll directly with Call DLL Function...I hope that helps.
Gareth Owen
Posts: 149
Joined: Fri Oct 21, 2005 8:42 am
Location: UK

Post by Gareth Owen »

Any clues on how I would code the loop? I have not had too much time playing with this part of IA

Cheers
sinan
Site Admin
Posts: 1037
Joined: Sat Nov 13, 2004 8:12 am
Contact:

Post by sinan »

Please check the attached script. It contains an example loop.

File Attached:

<a href="files/112420051055/Delete Everything.mia">Delete Everything.mia
Dana Epp
Posts: 29
Joined: Wed Dec 01, 2004 2:27 pm

Post by Dana Epp »

I looked at this script as I am having a similar problem.

Issue is, you cannot use labels inside a condition block, so says the InstallAware compiler. Which means this mia script won't work for code in the uninstall condition block.

All I want to do is the equiv of:

rmdir /S /Q $PATH$

Any ideas?
---
Regards,
Dana Epp
Dana Epp
Posts: 29
Joined: Wed Dec 01, 2004 2:27 pm

Post by Dana Epp »

After talking with Sinan a bit, it looks like there is a way around this.

His script works fine. The problem is you can't place it in the REMOVE condition block during uninstall.

My solution was to place a condition check near the end of the file that basically is:

Code: Select all

if Variable REMOVE not Equals TRUE
     GoTo Label: End Delete Files
end
Then add a new Label of "End Delete Files" at the end of the code in Sinan's original mia script. Walla. It all works as expected.

Thanks for the sample code and the idea for a work around for the conditional block issue Sinan. Much appreciated.[/code]
---
Regards,
Dana Epp
[email protected]
Posts: 10
Joined: Thu Aug 19, 2010 4:47 pm

Re: Removing everything from the TARGETDIR on uninstall

Post by [email protected] »

I need to accomplish the same task. The script mentioned seems to be missing, any updates?

I also need to delete file from the "Common Application Data" folder upon install. I expect that I can use the same logic in the script to accomplish this task as well.

Any help given is appreciated,

Steve
mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Removing everything from the TARGETDIR on uninstall

Post by mills »

Try the command Delete Files Recursive.
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
[email protected]
Posts: 10
Joined: Thu Aug 19, 2010 4:47 pm

Re: Removing everything from the TARGETDIR on uninstall

Post by [email protected] »

Thanks - it worked to delete all of the files, and as advertised it didn't delete the folder. I do want the folder deleted though. How is that accomplished?

Thanks,

Steve
mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Removing everything from the TARGETDIR on uninstall

Post by mills »

There are a couple of ways described here:
http://www.installaware.com/forum/viewt ... 1e3de71a9b
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
Post Reply