Recursively remove empty parent directories: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
ParallaxTZ (talk | contribs) |
ParallaxTZ (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
This function and example function call can be used to recursively delete empty parent folders of a given folder. | This function and example function call can be used to recursively delete empty parent folders of a given folder. | ||
(Courtesy of the folks at [http://www.redbugtech.com](www.redbugtech.com)) | (Courtesy of the folks at [http://www.redbugtech.com Redbug Technologies] (www.redbugtech.com)) | ||
== The Script == | == The Script == |
Revision as of 15:11, 11 July 2005
Author: ParallaxTZ (talk, contrib) |
Description
This function and example function call can be used to recursively delete empty parent folders of a given folder.
(Courtesy of the folks at Redbug Technologies (www.redbugtech.com))
The Script
Function un.RMDirUP !define RMDirUP '!insertmacro RMDirUPCall' !macro RMDirUPCall _PATH push '${_PATH}' Call un.RMDirUP !macroend ; $0 - current folder ClearErrors Exch $0 ;DetailPrint "ASDF - $0\.." RMDir "$0\.." IfErrors Skip ${RMDirUP} "$0\.." Skip: Pop $0 FunctionEnd
Usage
RMDir /r "$INSTDIR" ;remove $INSTDIR and all files/subfolders ${RMDirUP} "$INSTDIR" ;remove $INSTDIR's parents (if each is empty ONLY)