Archive: How to add files by wildcards, but uninstall only what is installed


How to add files by wildcards, but uninstall only what is installed
If I want to uninstall only installed files - I must create log-file. It's easy if I'll write:
SetOutPath "$INSTDIR\Langs"
File "Langs\Spanish.txt"
File "Langs\German.txt"
File "Langs\French.txt"

But how to wrtie file names (French.txt, German.txt and so on) to log file if code will be:
SetOutPath "$INSTDIR\Langs"
File "Langs\*.txt"

Or I must always use full names, if I want ot create such uninstaller? If there are to many files - what will be more easy: to write their full names and paths to both installer and uninstaller or to use File "SomeDir\*.<exttension>" or File /r "Somedir\*.<extension>" and to add some macro to the script?
Thanks.


This thread is full of information about this topic.


Don't you think, that it will be usefull to add new switch \log for example to "File" command in the next NSIS release?
For example if code is
SetOutPath "$INSTDIR\Somedir"
File \log \r "Source\*.*"
then installer will automatically generate log with installed files and their paths and put this log into installed dir.
In uninstaller it will be only
RMDir \log "$INSTDIR\Somedir"
and uninstaller will automatically read log and delete only needed files.

It will be great help for newbies, or for those, who want to delete only installed files and don't want to explore how to write special macro or huge amount of commands for that.


Rather than adding a \log switch for each specific command, it would be much better to use a CreateUninstallLog true|false

However, I doubt this will be implemented. If it's possible using NSIS script already available, then why make it a built-in feature?

-Stu


Here is the simplest way to achieve it. I just put it up on the Archive:
http://nsis.sourceforge.net/archive/...79&instances=0

-Stu


>>Here is the simplest way to achieve it

As I understood I must to write every file name with its extension ("file1.ext"), but if there are hundred of files in folders and subfolders and I want to write *.* when adding files what must I change in this code? Can I use ${File} \r "Source\*.*" or something like that or only
${File} "file1.ext"
${File} "file2.ext"
....
${File} "file100.ext"
>> If it's possible using NSIS script already available, then why make it a built-in feature?

Many things can be done using script, but for example why RmDir has [/r] switch if user can write
Delete "$INSTDIR\Somedir\*.*"
RmDir "$INSTDIR\Somedir"
Possibly because of quick and easy use of RmDir /r?

It's quick and easy to write CreàteUninstàllLog (and ReàdUninstàllLog to uninstàller) and not to think how to create needed code.
I think such implementation will be useful no only for me or will be unneded because of rare use.


We are using Wise Installer and trying out NSIS. <br> With Wise every action (installed file or registry setting) is written to a log file. The uninstaller then undo what is written in the log file.<br> Is there in NSIS a similar function or script?


>Is there in NSIS a similar function or script?

You must write all code by yourself. Afrow UK thinks that it can be easy to all, but imho NSIS must have single command for that useful function.