Archive: General Query for all - Removing Files on Uninstall - What method do you use?


General Query for all - Removing Files on Uninstall - What method do you use?
Hi all,

I am just curious, what method do people here use for removing their installed files during the uninstaller?

Especially for very LARGE installers where there are too many files to manually type in each file name in the uninstall method.

As I see it, there are 3 different options.

1) No special "logging" makensis.exe build.
Just "RMDIR /r" and run with it.

2) No special "logging" makensis.exe build.
Instead use the "Advanced Uninstall Log NSIS Header" and have it log during install, and uninstall based on that.
http://nsis.sourceforge.net/Advanced...og_NSIS_Header

3) Use the special "logging" makensis.exe build.
Parse the log to do the file removal on uninstall.
http://nsis.sourceforge.net/Uninstall_from_NSIS_log


What leads me to ask this question, is I came from the WISE world, where the install log is fundamental to the uninstall procedure.

I actually started to get liking the NSIS method of not logging the install, but just go ahead and blow away your created directories as you see fit, and have released a few of my Installers with this.

But I have gotten a complaint that this is a HORRIBLE idea, in that if your customer has created important files underneath your directory, we are indiscriminately blowing away things that shouldn't be blown away.

They have a point.

So this leads me to asking the rest of the NSIS world...

Has anyone else ran into the same problem?
What did you decide to do?
Did I miss any options?

Thanks!
Scott


Obviously, RmDir /r should be used with caution.
Recently discussed here in forum a case where accidentally removed the entire Start Menu on a system where the instruction implemented improperly.

My choice (that's obvious too) is advanced uninstall log, because I wrote it ;)

BTW if someone of you programmers could somehow fix that issue in which throws the list several times, I believe advanced uninstall log will become more useful tool.


You can still use RMDir /r but you should do some strenuous validation on the uninstall path first:

http://nsis.sourceforge.net/Validati...fore_uninstall

Stu


Hi Red Wine,

The Installer that I am concerned with has a HUGE amount of files and directories that get installed.

We are talking 13,000+ files, and 800+ directories.

rmdir /r (with validation of the top level directory) is very fast and efficient.

But wow, is it dangerous, if someone uses anything under that top level directory for their own purposes.

I was thinking about trying the "Advanced Uninstall Log", but I really worry about the time/efficiency of it...

Throwing the list of 13000+ files multiple times seems like a very time consuming task...

The "special" logging build of makensis.exe is interesting, but I do not like the fact that it is "special"...

I would hate to invest time/energy into writing code to it, only to have the feature "go away" in the future.

I wonder if anyone has ever written a plugin to NSIS that does what the "special" build does...

Or maybe the "special" logging feature could move from a compile time option to be a run time option?

Or maybe there is a better, yet undiscovered way to do this?

Thanks!
Scott


All the special build does it generate a log file at run time. The reason it is 'special' is because the majority of people do not need logging support and the overheard that it induces. The script that uninstalls from the log simply parses it for File instructions, so that may be your best route. Otherwise, use RMDir /r and check the link that I provided. As long as you check a prominent file is located in $INSTDIR (among other checks) before you call RMDir /r then everything should be ok.

Stu


Hi Afrow UK,

Thanks for your responses.

What about the problem where the user might have added their own files or directories inside of $INSTDIR after the Installer was run?

RMDir /r on uninstall would blow away these extra files by mistake!

Scott


Yes it would.

Stu


If you don't want to delete files using one of these scripts then you can instead write an NSIS installer which loops through all your files (i.e. using RecFind or Locate) and writes your NSIS code for you.
http://nsis.sourceforge.net/Invoking...n_compile-time

Stu


Throwing the list of 13000+ files multiple times seems like a very time consuming task...
Using advanced uninstall log when installing/uninstalling such a huge amount of files/directories it is NOT a very time consuming task because it does not need to throw the list more than once.
Time consuming task might be noticed depending on target machine, and only in the case where the target installation directory contains such a huge amount of files/directories, either prior the installation, or added later by the users.

I do the RMDIR /r option.

I do this because of our auto updates. If we add new files during an update, I don't want to get into the hairy details of adding to the log to keep it perfect. I find it much simpler to simply uninstall an entire folder.

I also don't yet validate to make sure the folder I'm deleting isn't, say, the Program Files folder. :O One of these days, I'm going to have to put that in.

As for user added files, those should generally happen under an individual user profile or all users profile. And it's generally fine to not touch those files during the uninstall.

For example, long ago, we used to store user setting files in a Program Files folder. I did this because i thought it was normal practice, and because it let me delete every trace of our app on the users computer. But with user permissions and especially Windows Vista enforcing it, storing settings and such in Program Files is a very bad idea.