Get number of subdirs in dir path: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Added category links.) |
m (Adding new author and category links.) |
||
Line 1: | Line 1: | ||
{{PageAuthor|Afrow UK}} | |||
== Description == | == Description == | ||
This script gets the number of sub dirs in a directory path (string) | This script gets the number of sub dirs in a directory path (string) | ||
Line 45: | Line 43: | ||
-Stu | -Stu | ||
[[ | [[Category:Disk, Path & File Functions]] |
Revision as of 12:23, 24 June 2005
Author: Afrow UK (talk, contrib) |
Description
This script gets the number of sub dirs in a directory path (string) This is useful in conjunction with the UninstallDirs function.
Usage
Push $INSTDIR #input Call SubdirsAmount Pop $R0 ;number of subdirs in $INSTDIR
The Function
Function SubdirsAmount Exch $R0 ;input string Push $R1 Push $R2 Push $R3 Push $R4 StrCpy $R1 0 StrLen $R2 $R0 loop: IntOp $R1 $R1 + 1 StrCpy $R3 $R0 1 -$R1 StrCmp $R1 $R2 exit StrCmp $R3 "\" 0 loop IntOp $R4 $R4 + 1 Goto loop exit: StrCpy $R0 $R4 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 ;output FunctionEnd
Created for tderouin after this topic on the NSIS Forums.
-Stu