Cleanup during uninstall
I have written a custom action in VBScript that recursively deletes the sub-folders under TARGETDIR during uninstall. Unfortunately, it is failing due to permission issues on Vista. I have specified CA type as '6'. Also tried with '3078' (3072+6) but no luck.
The reason behind having such CA is to delete those folders (and files in those folders) that were created by the application and NOT during the installation. e.g LOGS folder to store logs etc.
The reason behind having such CA is to delete those folders (and files in those folders) that were created by the application and NOT during the installation. e.g LOGS folder to store logs etc.
0 Comments
[ + ] Show comments
Answers (9)
Please log in to answer
Posted by:
anonymous_9363
14 years ago
Ah...an incomplete capture or failure to run the application after a test installation, to check for precisely that activity.
Anyway, as pointed out, just add the folder(s) to the RemoveFile table.
Anyway, as pointed out, just add the folder(s) to the RemoveFile table.
Posted by:
milindsm
14 years ago
Posted by:
cygan
14 years ago
ORIGINAL: milindsm
Hello,
RemoveFile table will remove files and empty folders but what about the folders that are not empty...!!???
read the sdk on the removefile table
enter the files only to be removed (these files will exist in a folder)
setting the filename column to null will remove empty folders
and don't forget your installmode flag
Posted by:
milindsm
14 years ago
setting the filename column to null will remove empty folders
But what about non-empty folders??? I have to empty them before deletion. And these non-empty folders can have even more sub-folders in-turn.
Moreover, I am not aware of folder names as the folder created due to application execution can have name something like Folder_Name_Timestamp
Posted by:
thugz888
14 years ago
Posted by:
milindsm
14 years ago
BTW, I am not even able to remove an empty folder. This is how my RemoveFile table looks like
FileKey : Cleaner
Component_ : Some component key from Component table
FileName : left blank (I hope keeping it blank makes it null)
DirProperty : INSTALLDIR
InstallMode : 2
I have created a dummy folder called "[font="courier new"]Empty" at [font="courier new"]"C:\Program Files\Application Name\"
FYI, OS is Vista.
FileKey : Cleaner
Component_ : Some component key from Component table
FileName : left blank (I hope keeping it blank makes it null)
DirProperty : INSTALLDIR
InstallMode : 2
I have created a dummy folder called "[font="courier new"]Empty" at [font="courier new"]"C:\Program Files\Application Name\"
FYI, OS is Vista.
Posted by:
anonymous_9363
14 years ago
the folder created due to application execution can have name something like Folder_Name_TimestampOnly now we get this information?!? If you are unable to determine the folder names, you cannot use the RemoveFile table. You need to go back to your script.
So, back to square one...what "permission issues" are you having? If it's simply 'Access denied', you will need to permission the parent folder so that the uninstalling user has rights to delete files and folders AND ensure that permissions for sub-folders are inherited from the parent.
Posted by:
milindsm
14 years ago
I got it...!!!! Thanks all for your help!!! here's what i did...
- Created a CA (immediate execution say CA1) with TYPE 51 and Target [TARGETDIR]. Source name should be same as that of the custom action (say CA2) that will actually cleanup the folders and files created by the application during execution.
- Placed this CA before InstallInitialize with condition REMOVE="ALL".
- Created CA2 (Deferred) with type 3078 (3072+6).
- Placed it InstallExecute and before InstallFinalize with condition as REMOVE=â€ÂALLâ€Â.
- Of course VBScript is anyway there in Binary table that will recursively delete the folder tree starting from the leaf node.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.