You are here

NSIS help - query folder name

3 posts / 0 new
Last post
Travis Carrico
Offline
Last seen: 16 years 1 day ago
Developer
Joined: 2006-10-22 00:30
NSIS help - query folder name

is it possible to query the name of the only folder inside my specified folder?

digitxp
digitxp's picture
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-03 18:33
I think

Wraithdu made a GetFolderPath.nsh .
https://portableapps.com/node/11936
But it doesn't query folder names :(.
Hmm...
Why do you need to query in the first place?

Insert original signature here with Greasemonkey Script.

wraithdu
Offline
Last seen: 11 years 5 months ago
Developer
Joined: 2007-06-27 20:22
Depends what you need here.

Depends what you need here. If you know the name of your folder, then this is all you need -

IfFileExists "X:\Path\to\folder\*.*" jump_found jump_notfound

Otherwise if you need to search -

OutFile test.exe

!include LogicLib.nsh
!include FileFunc.nsh
!insertmacro GetFileAttributes

Var searchdir

Section
	StrCpy $searchdir "C:\Program Files"
	FindFirst $0 $1 "$searchdir\*.*"
	${Do}
		${If} $1 == "."
		${OrIf} $1 == ".."
			; do nothing
		${Else}
			${GetFileAttributes} "$searchdir\$1" "DIRECTORY" $2
				${If} $2 = 1 ; is directory
					DetailPrint $1
				${EndIf}
		${EndIf}
		FindNext $0 $1
	${LoopUntil} $1 == ""
	FindClose $0
SectionEnd
Log in or register to post comments