Page 1 of 1
Removing everything from the TARGETDIR on uninstall
Posted: Thu Nov 24, 2005 4:35 am
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,
Posted: Thu Nov 24, 2005 5:23 am
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.
Posted: Thu Nov 24, 2005 9:57 am
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
Posted: Thu Nov 24, 2005 11:55 am
by sinan
Please check the attached script. It contains an example loop.
File Attached:
<a href="files/112420051055/Delete Everything.mia">Delete Everything.mia
Posted: Wed Nov 30, 2005 6:36 pm
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?
Posted: Wed Nov 30, 2005 7:59 pm
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]
Re: Removing everything from the TARGETDIR on uninstall
Posted: Tue Aug 24, 2010 10:27 am
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
Re: Removing everything from the TARGETDIR on uninstall
Posted: Tue Aug 24, 2010 4:19 pm
by mills
Try the command Delete Files Recursive.
Re: Removing everything from the TARGETDIR on uninstall
Posted: Wed Aug 25, 2010 9:26 am
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
Re: Removing everything from the TARGETDIR on uninstall
Posted: Wed Aug 25, 2010 3:49 pm
by mills