Archive: Getting list of subfolders in a folder


Getting list of subfolders in a folder
Hello all,

Can you please tell me if there's a NSIS script to get a list or get the name, one at a time, of each subfolder inside a folder? Only one level below.

As in input -> $DOCUMENTS
Output:
C:\Users\..\My Documents\My Pictures
C:\Users\..\My Documents\My Music
C:\Users\..\My Documents\Downloads...

...and so on.

I even tried redirecting the output of 'dir "$DOCUMENTS" /ad /b > "$INSTDIR\directories.txt"' with nsExex::Exec and plain Exec... to no avail. If the file was created, all I'd have to do is a loop to read each line from it, but I didn't manage to get that to work either.

Thanks in advance.


FindFirst $0 $1 "$INSTDIR\*.*"
loop:
StrCmp $1 "" done
${If} ${FileExists} "$1\*.*"
DetailPrint "Subdir found: $1"
${EndIf}
FindNext $0 $1
Goto loop
done:
FindClose $0