Skip to content
⌘ NSIS Forum Archive

how to use findfirst, etc. ?

3 posts

Comm@nder21#

how to use findfirst, etc. ?

hello!

i want to get all the filenames of a specific file-type in one specific directory.
i think, i'll have to use FindFirst, FindNext, etc.
but how?

anone can help me?
deguix#
>To search for files with a extension and in a certain folder, use (example):

FindFirst $0 $1 "${NSISDIR}\Examples\*.nsi"
Will return to $1 the first file found with *.nsi extension.

$0 is the handle, don't change it until FindClose.

"${NSISDIR}\Examples\*.nsi" is where and what files want to search for.

>To confirm if the returned file is really a file, use (example):

IfFileExists "${NSISDIR}\$1\*.*" IsDir IsFile

IsDir: ;If the file is a dir, will execute this code below

SetErrors

IsFile: ;Returning to normal code
(The example shows that will set errors each time a file is really a folder.)

>To detect the next file with "*.nsi" use (example):

FindNext $0 $1
Will return to $1 the next file found with *.nsi extension.

>To end the detection use (example):

FindClose $0