Skip to content
⌘ NSIS Forum Archive

Generate list of files and directories for uninstaller

16 posts

Instructor#

Generate list of files and directories for uninstaller

When your installer include many files for install, it's take much time to write in uninstall section files and directories than will be deleted.

It's script to generate list of files and directories for uninstaller with command line support (/? for help)

Script used headers
Instructor#edited
Uninstaller will remove only unmodified files


Files description:
"unListDate.nsi" - List generator (unListDate.exe) script
"Test.nsi"         - Test script
"TestFiles\*.*"  - Test script files

Scripts used headers
Instructor#
"unList" v1.1
"unListDate" v1.1

Changes:
-Cosmetic improvements
-unList command line now based on unListDate

Scripts used headers
JackOfTrades#
Thanks

I've come to the forums searching for answers a number of times since I started using NSIS. (Love it, btw.)

A number of those times, the answer (and often with useable script as well) has come from Instructor.

I registered just to reply to a particuarly useful post to say thanks.

Jess
Instructor#
"unList" v1.2
"unListDate" v1.2

Changes:
1. Code clean up
2. Better errors check
3. Added command line option to turn off MessageBoxes

Attachment with binaries (scripts used headers)
Instructor#
"unList" v1.3
"unListDate" v1.3

Changes:
-added file filter as command option (Patrick Graf)


P.S.
Patrick I could not send you reply on your e-mail.
Instructor#
"unList" v1.4

Changes:
-combine unList and unListDate to one script and added /DATE=[0|1] parameter (Matei "Ambient.Impact" Stanca)
Instructor#
Greetings guilhem.martin, from a very satisfied developer of "UnList" 🙂

"unList" v1.5

Changes:
-updated to support latest version of GetOptions function
Guest#
'GetTime' should be called using System time instead of local time. Otherwise all files will be ignored after the time has been changed to daylight saving time!

Two lines must be modified therefore:

${GetTime} '$9' 'M' $0 $1 $2 $3 $4 $5 $6

into

${GetTime} '$9' 'MS' $0 $1 $2 $3 $4 $5 $6


and

FileWrite $R4 `$PREFIX$3un.GetTime} "$UNDIR_VAR\$9" "M" $$0 $$1 $$2 $$3 $$4 $$5 $$6$\r$\n`

into

FileWrite $R4 `$PREFIX$3un.GetTime} "$UNDIR_VAR\$9" "MS" $$0 $$1 $$2 $$3 $$4 $$5 $$6$\r$\n`
dbach#
Hi Instructor.

Thank you for this very cool tool. I know some idiots who installed really some products directly into the $ProgramFiles directory. This tool keep these idiots secure on uninstalltion.

PLEASE, Could you announce this wonderful tool on WikiPage of NSIS (http://nsis.sourceforge.net/Category:Related_Software)? Thank you very very much. :-)
eric0000#
Hello

For me this script occasionally neglects to uninstall a file, even though the file has not been modified. The problem occurs because two different values are returned for the file's timestamp.

When unList.exe is run, the line

${GetTime} '$9' 'MS' $0 $1 $2 $3 $4 $5 $6

returns one value for the file's timestamp.

unList.exe then autogenerates the line e.g.

${un.GetTime} "$INSTDIR\Workbooks\Math\primeNumbers.xls" "MS" $0 $1 $2 $3 $4 $5 $6

which runs as part of my uninstaller but when that line runs it returns a timestamp one second into the future, causing the subsequent test

StrCmp "$0/$1/$2-$4:$5:$6" "27/04/2006-15:02:08" 0 +3

to return false.

A quick fix is to exclude seconds from the comparison e.g. in unList.nsi change line

FileWrite $R4 `$PREFIXStrCmp "$$0/$$1/$$2-$$4:$$5:$$6" "$0/$1/$2-$4:$5:$6" 0 +3$\r$\n`

to

FileWrite $R4 `$PREFIXStrCmp "$$0/$$1/$$2-$$4:$$5" "$0/$1/$2-$4:$5" 0 +3$\r$\n`

Regards,
Eric
pospec#
Hi Instructor!

I have noticed that if I ask unList to create log for empty directory then it:
1) Delete log file, that should be created
2) Doesn't create log file

Is it intension? If it is, then I have another question: Why it doesn't create empty log?
skidaddytn#
Sorry to necropost here but since the question of maintaining an auto-manifest for un-installation has come up so much, I thought I would bring this one back to life and also show a patch that I had to make in order to have it work in newer versions of Windows 10.

I've been using this technique by Instructor for years (many thanks) and it recently quit working due to its use of the %userprofile%\appdata\local\temp folder. When files are copied out of here via the script, they now come with some strange ACL file permissions causing failure. Its also important to note that this secondary EXE should be called with "!system" and not "!execute" from your main NSIS script.

Anyhow, here is the needed patch for modern windows 10 if anyone needs it:


--- C:/unListv1_5.nsi Tue Jun 10 17:06:16 2014
+++ C:/unListv1_51.nsi Tue Mar 5 16:10:34 2019
@@ -13 +13,5 @@
-Name "unList v1.5"
+; 3/5/2019 v1.51 Edited to save temp files to working folder instead of $PLUGINSDIR due to
+; permissions issues when copied back to work folder.
+
+
+Name "unList v1.51"
@@ -147,4 +151,7 @@ Function main
- InitPluginsDir
- GetTempFileName $R1 $PLUGINSDIR
- GetTempFileName $R2 $PLUGINSDIR
- GetTempFileName $R3 $PLUGINSDIR
+ ;InitPluginsDir
+ ;GetTempFileName $R1 $PLUGINSDIR
+ ;GetTempFileName $R2 $PLUGINSDIR
+ ;GetTempFileName $R3 $PLUGINSDIR
+ StrCpy $R1 'temp1.txt'
+ StrCpy $R2 'temp2.txt'
+ StrCpy $R3 'temp3.txt'
@@ -177,0 +185,2 @@ Function main
+ Delete '$R1'
+ Delete '$R3'