Archive: Removing directory upon installation with new installer


Removing directory upon installation with new installer
Hey all.
I've searched everywhere, went the trial and error route, and still no luck. Here's what I'm trying to do:

I have an application that saves user data to the common application data folder (C:\Documents and Settings\All Users\Application Data\My company\my application). The uninstaller I created for this app does not remove this application data folder...no biggie. However, I have an update to this application, and I would like it to remove the user's application data folder during the installation as to avoid conflict with my updated application.

I've tried placing delete variables in every section, creating new callback functions, and nothing. Please note, I'm a fairly novice user, and any help will be greatly appreciated.
Thanks for reading :)


Have you tried:

RMDir /r 'C:\Documents and Settings\All Users\Application Data\My company\my application'

This will delete the directory and all contents, so be careful.

"Note that the current working directory can not be deleted. The current working directory is set by SetOutPath."

See additional notes on this in the users manual.

So you might need to do something like:
SetOutPath 'C:\someotherexistingdirectory'
RMDir /r 'C:\Documents and Settings\All Users\Application Data\My company\my application'

This is untested code, I think you might need to use double back slashes or forward slashes. Beucase the \ might be treated liek an escape sequence.

Edit: Also note that deleting things from All Users might require administrative priviliages.

You can add the /REBOOTOK flag to allow the delete to occur after the computer reboots. This is useful if the user has that folder open which might prevent the deletion, or if a file in the folder is opened/locked by some app.