Source language: Translate to:

Count Images in a directory

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Count Images in a directory

Postby Neopasti » Wed Nov 27, 2013 9:59 am

Hi NeoBooker..

I have a Directory(Folder) with more than thousand Images (like:Mineral1.jpg Mineral2.jpg.....Mineraln.jpg) in it.
Is there a way to count the images in these Directory(Folder) and store the result in a variable?

i would be pleased to get more information.

Thanks to all.
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am

Re: Count Images in a directory

Postby dec » Wed Nov 27, 2013 10:06 am

Hello,

Welcome to the forum! Take a look at this recent thread. ;)
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Count Images in a directory

Postby Neopasti » Wed Nov 27, 2013 10:43 am

Thanks for Your answer dec..

but it's not what I want. I don't need a List.

I need the Sum of *.*jpg's in a Directory (587 or 1004 or 3756)

Is there another posibility? or its possible with a Plugin

Thank you very much
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am

Re: Count Images in a directory

Postby dec » Wed Nov 27, 2013 10:57 am

Hello,

Take a look at this code:

Code: Select all
FileList "F:\Temp\*.jpg" "Files" "[FoundFiles]"
StrParse "[FoundFiles]" "[#13]" "[File]" "[Total]"


"[Total]" variable store the number of files founds.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Count Images in a directory

Postby Neopasti » Thu Nov 28, 2013 7:48 am

Hello,

I used this code Example:
FileList "E:\NeoBook 5\MineralBookAdvanced\Mineralienbilder1\*.jpg" "Files" "[FoundFiles]"
StrParse "[FoundFiles]" "[#13]" "[File]" "[Total]"

The Variable of [Total] is always 1 but in the Folder are more than 3000 jpg Files

I have no Idea how I can check the Sum of jpgFiles in this Folder.


Thanks all
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am

Re: Count Images in a directory

Postby dec » Thu Nov 28, 2013 8:07 am

Hello,

The code work like expected here. Note the action do not take care for subdirectories. On the other hand, "[Total]" store "0" if no one file are found, so your "1" result indicate at the least one matched file. I try listing a directory plenty of images and all work like expected.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Count Images in a directory

Postby Neopasti » Thu Nov 28, 2013 8:41 am

Thanks dec....

but I think you misunderstand me.


With this code I can check is a jpg in the Folder (1) or is no jpg in the Folder (0) Is that right?

But I like to check how much jpgs in this Folder(E:\NeoBook 5\MineralBookAdvanced\Mineralienbilder1\*.jpg)

Example: in the Folder Mineralienbilder1 are 3 jpgFiles(Mineral1.jpg..Mineral2.jpg..Mineral3.jpg-->the result must be 3) copie one jpg in the Folder Mineralienbilder1
(Mineral1.jpg..Mineral2.jpg..Mineral3.jpg...Mineral4.jpg-->the result must be 4) and so on.

Sorry for my bad english
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am

Re: Count Images in a directory

Postby CN_Iceman » Thu Nov 28, 2013 10:29 am

David's proposed code works as expected.

What you really want is the program to calculate the number of images in the folder each time there are changes? In real time?

Otherwise, every time you copy a file (or some files), you have to run the code that tells you David, you would get the number of graphs in the folder in that moment.

If what you want is that whenever there are changes in a folder, I recommend you take a look at David npNots plugin. It works like a charm!!

Greetings.
Greetings/Saludos, Jose.
www.icemansoft.es
User avatar
CN_Iceman
 
Posts: 297
Joined: Tue Mar 01, 2011 11:04 am
Location: España

Re: Count Images in a directory

Postby dec » Thu Nov 28, 2013 10:44 am

Hello,

Jose has right. "FileList" do not return "0" or "1". On the contrary this action returns a variable containing the file paths the action found separated by carriage returns. So in fact is the "StrParse" action who take the "FileList" returns and parse it in order to get separated all the founded files and also to count the total number of founded files.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Count Images in a directory

Postby Gaev » Thu Nov 28, 2013 10:56 am

Neopasti:

I can confirm that David's code works as expected ... I copied the code in your post and then pasted it in my lab pub ... just changed the folder reference.

So, after double checking that the code in your pub is exactly the same as that you posted here ...

a) use the debugger to see the values for variables [FoundFiles] and [count] ... and also any variables starting with [Names] ... like [Names1], [Names2] etc. ... one for each matching file.

b) if possible, post an image of the screenshot of Windows Explorer that shows the Address Box (E:\NeoBook 5\MineralBookAdvanced\Mineralienbilder1) ... and the right panel showing a Details View of some of the jpg files in it.

c) Tell us the version of NeoBook (mine is 5.8.4 April 2013).
User avatar
Gaev
 
Posts: 3733
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Count Images in a directory

Postby dec » Thu Nov 28, 2013 2:49 pm

Hello,

I feel good to add a new npDirFilesCount action to my npUtil plugin. The action do not list the files, just count it. And can do the job using a file mask and optionally looking also for subdirectories. If we need a more advanced "search engine way" my npFind plugin can come to the rescue.

Code: Select all
npDirFilesCount "[YourDirectoryPath]" "*.jpg" "True" "[TotalFiles]"


On the other hand I am proudly to announce this is the action number 150 of my npUtil plugin, number 1.013 in the total of my NeoPlugins. ;)

Hope useful for you!
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: Count Images in a directory

Postby Neopasti » Fri Nov 29, 2013 6:53 am

The problem is solved !

Thanks to all for the comments.

Special Thank for the updatet 'npDirFilesCount action' in the 'npUtil plugin' from dec.

Thats exact what I want.

Nice Weekend to all NeoBookers
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am

Re: Count Images in a directory

Postby Leos » Mon Dec 02, 2013 11:43 am

Hi,
maybe this can help you.
At the end you obtain the file with the list of images in the folder.
Using "files actions" you can easily get what you want.

http://www.neosoftware.com/community/viewtopic.php?f=6&t=20281
User avatar
Leos
 
Posts: 178
Joined: Mon Apr 04, 2005 11:13 am
Location: Coimbra, Portugal

Re: Count Images in a directory

Postby Neopasti » Wed Dec 04, 2013 12:43 pm

Thanks for your reply,Leos
Neopasti
 
Posts: 12
Joined: Tue Jan 25, 2011 5:26 am


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 1 guest