Archive: Count files


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 !


Please read the manual under 'File Instructions'.

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.5.13


you can also use the locate function if you need a number of filters and support for subdirs


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...)


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

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. :)


Thanks to all ! =)

It's working now :)