Old 16th August 2010, 08:39   #1
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
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 !
Noude is offline   Reply With Quote
Old 16th August 2010, 09:10   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Please read the manual under 'File Instructions'.

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.5.13
MSG is offline   Reply With Quote
Old 16th August 2010, 09:18   #3
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
you can also use the locate function if you need a number of filters and support for subdirs
Yathosho is offline   Reply With Quote
Old 16th August 2010, 09:24   #4
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
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...)
Noude is offline   Reply With Quote
Old 16th August 2010, 10:58   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
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

Last edited by Afrow UK; 16th August 2010 at 11:03. Reason: Added sub directory check
Afrow UK is offline   Reply With Quote
Old 16th August 2010, 10:59   #6
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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.
MSG is offline   Reply With Quote
Old 16th August 2010, 12:13   #7
Noude
Junior Member
 
Join Date: Aug 2010
Posts: 40
Thanks to all ! =)

It's working now
Noude is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump