rockerz
23rd July 2007 05:22 UTC
Remove non empty directories and subdirectories
Hi all,
For my installer purposes, I have several directories, each having multiple subdirectories and files within them. During the uninstall I want all of them to be deleted, but I cant find a provision to delete non empty directories recursively?
It is unrealistic for me to delete each file/subdirectory inside the directories before using the RMDir command.
I tried using RMDir /r "$INSTDIR/My Package". However it doesnt seem to work.
Please help. thanks :)
Red Wine
23rd July 2007 05:31 UTC
RmDir /r does exactly this, removes everything no matter empty or not, unless there are files in use, hence should be used with caution.
rockerz
23rd July 2007 07:01 UTC
I have already tried using RmDir /r but doesnt seem to work. All the directories and files are still present. I dont think any of them shd be running. I m putting RmDir /r in the Uninstall Section of my code. Any probable reasons for this not working?
Thanks
Red Wine
23rd July 2007 09:16 UTC
Assuming that there's not the command SetOutPath "$INSTDIR" RmDir /r "$INSTDIR" should remove the entire installation folder.
Beware of that though.
rockerz
23rd July 2007 11:59 UTC
installation prohibited in C:\ (HDD) directly
Ok..RMDir /r seems to work now. however i have another query. Why doesnt NSIS allow me to install the package in any of the hard disk drives directly. i.e if I set the installation path as C:\ (or any other HDD), I cannot proceed to the next page. Is this a cautionary step to avoid entire deletion during uninstall??
Please help..thanks .
Red Wine
23rd July 2007 12:49 UTC
You need AllowRootDirInstall true because the default is false.
Afrow UK
23rd July 2007 13:01 UTC
As Red Wine said, beware of using RMDir /r on $INSTDIR:
http://nsis.sourceforge.net/Validati...fore_uninstall
Stu