Archive: Remove non empty directories and subdirectories


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 :)


RmDir /r does exactly this, removes everything no matter empty or not, unless there are files in use, hence should be used with caution.


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


Assuming that there's not the command SetOutPath "$INSTDIR" RmDir /r "$INSTDIR" should remove the entire installation folder.
Beware of that though.


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 .


You need AllowRootDirInstall true because the default is false.


As Red Wine said, beware of using RMDir /r on $INSTDIR:
http://nsis.sourceforge.net/Validati...fore_uninstall

Stu