Recursively remove empty parent directories: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
ParallaxTZ (talk | contribs) No edit summary |
ParallaxTZ (talk | contribs) |
||
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]) | (Courtesy of the folks at [http://www.redbugtech.com](www.redbugtech.com)) | ||
== The Script == | == The Script == |
Revision as of 15:10, 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 [1](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)