Archive: Folder/File plugin needed


Folder/File plugin needed
I'm looking for a way to get a count of the number of files/folders in a directory without having to manually loop through the directory and count them.

Unfortunately, writing plugins isn't one of my strong points. I know that with VBScript, I can use folders.count or files.count property (with the help of scripting.fileSystemObject).

I'd like to be able to do the same from NSIS--either directly or via a plugin/system call.

Any ideas?


I'm looking for a way to get a count of the number of files/folders in a directory without having to manually loop through the directory and count them.
There is already a plug-in to do this:

http://nsis.sourceforge.net/Locate_plugin

Thanks for the reply.

I saw this plugin (which is also included with NSIS 2.12).

However, I don't see that any of its fuctions return an actual COUNT (sum) of the number of files or folder in a directory. The only way I can see getting a count with the locate plugin is to setup a loop to manually count the number of items. While this would work, it would make things a bit slower, especially if there were a lot of files/folders in a directory. That's why I was hoping for a plugin that would just eturn the answer in one step.

Here are a few examples I found that might help to better illustrate:
http://msdn.microsoft.com/library/de...d449b36287.asp
http://forums.microsoft.com/MSDN/Sho...84761&SiteID=1

EDIT:
Never Mind! I found what I was looking for. In the locate::GetSize plugin call, there is a way to get the count. (I didn't see it before because the name doesn't really match the function.) Thanks!


I agree. Name is a bit strange for the function itself...
But I suppose as long as the function works :)

-Stu


In the locate::GetSize plugin call, there is a way to get the count. (I didn't see it before because the name doesn't really match the function.)
Sorry I didn't mention the exact function. In fact I use the stand-alone version of the GetSize function because its plug-in is much smaller:

http://forums.winamp.com/showthread.php?threadid=224452

I saw this plugin (which is also included with NSIS 2.12).
"Locate" plugin is not included in NSIS
I didn't see it before because the name doesn't really match the function.
"GetSize" chief task is the get size of the folder and filial task to get number of files and directories.
In fact I use the stand-alone version of the GetSize function because its plug-in is much smaller
Better recompile "Locate" plugin with only "#define GETSIZE" and you will have the latest version and the small size.

Better recompile "Locate" plugin with only "#define GETSIZE" and you will have the latest version and the small size.
Thanks for the suggestion.

The GetSize plugin does exactly what I want so I did not bother upgrading to the newer Locate plugin (if I remember correctly the GetSize plugin appeared before the Locate plugin was updated to include the GetSize function).