Recursively remove empty parent directories: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
ParallaxTZ (talk | contribs) No edit summary |
(note inusage) |
||
Line 34: | Line 34: | ||
== Usage == | == Usage == | ||
The function declaration (as above) must appear before the call in the installation script. | |||
<highlight-nsis> | <highlight-nsis> | ||
RMDir /r "$INSTDIR" ;remove $INSTDIR and all files/subfolders | RMDir /r "$INSTDIR" ;remove $INSTDIR and all files/subfolders |
Revision as of 20:58, 6 July 2006
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
The function declaration (as above) must appear before the call in the installation script.
RMDir /r "$INSTDIR" ;remove $INSTDIR and all files/subfolders ${RMDirUP} "$INSTDIR" ;remove $INSTDIR's parents (if each is empty ONLY)