Skip to content
⌘ NSIS Forum Archive

Count files

7 posts

Noude#

Count files

Hello !

Please, I have to count how many files I have in a directory.
Is there a special function to do this or not ?
I don't find any answers on the Internet =( (and in the doc)

And if it's possible I want to have there name too ^^

Thanks for help !
MSG#
Please read the manual under 'File Instructions'.

Yathosho#
you can also use the locate function if you need a number of filters and support for subdirs
Noude#
thanks for your answers, but I don't think I need to have a number of filters.

MSG: Yes I already read this section of the manual, but I think I don't really understand how it can helps me (I think because of my bad English but...)
Afrow UK#edited
StrCpy $Counter 0
ClearErrors
FindFirst $R0 $R1 $DIR\*.*
${DoUntil} ${Errors}
${If} $R1 != .
${AndIf} $R1 != ..
${AndIfNot} ${FileExists} $DIR\$R1\*.*
IntOp $Counter $Counter + 1
${EndIf}
FindNext $R0 $R1
${Loop}
FindClose $R0
Stu
MSG#
Use LogicLib to create a loop where you FindNext until you reach the last file. Maybe add in a check to see whether an entry is really a filename and not a subdirectory (not sure if FindNext finds directories, you'd have to try).


ps: With "a number of filters" Yatasho means "several filters", not "the actual number of existing filters", or anything like that. >_>


edit: too late. 🙂