Network Automation Software
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Looping files and counting
Topic Summary:
Created On: 05/16/2011 10:42 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 05/16/2011 10:42 AM
User is offline View Users Profile Print this message

Author Icon
MichaelJeffreys
n00b (>6 posts)

Posts: 2
Joined: 05/06/2011

I am new to Automate and to looping.  Any help would be appreciated.

I have a list of 28  *.txt  files.

10 of the files are named *_404.txt

10 of the file are named *_505.txt

8 of the files are named *_606.txt

I need to loop through the files and count them by the number.

so an array would have in it ;

404    10

505    10

606     8

Any help or pointers would be appreciated

thanks

michaelj



 Category Survey
 05/16/2011 11:57 AM
User is offline View Users Profile Print this message

Author Icon
Rick Johnson
AUTOMATE EMPLOYEE

Posts: 2757
Joined: 07/14/2008

Hi Michael,

The attached example illustrates a method to obtain the file information from a folder, and shows the counts in a message box. You would modify the path to match the folder structure that you are working with. Does this sample help you accomplish your goal?

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
- Rick Johnson
Network Automation
 05/16/2011 01:18 PM
User is offline View Users Profile Print this message

Author Icon
MichaelJeffreys
n00b (>6 posts)

Posts: 2
Joined: 05/06/2011

Almost.  It gives me the results I need, but can that be put into an array or single dataset?

thanks for the info so far.  It has been helpful.

 



 Category Survey
 05/17/2011 01:47 PM
User is offline View Users Profile Print this message

Author Icon
Rick Johnson
AUTOMATE EMPLOYEE

Posts: 2757
Joined: 07/14/2008

Hi Michael,

How does this example work for you?


 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
- Rick Johnson
Network Automation
 06/14/2012 03:54 PM
User is offline View Users Profile Print this message

Author Icon
JivaJentile
Journeyman (50-99)

Posts: 94
Joined: 03/07/2006

rick~
i have a question. i have to get counts on large numbers of files, could be 3 or 4 thousand in a folder. im concerned that IF i load all the fileinfo into a dataset just to get a count, that i may risk memory errors or performance degradation.
simply looping the files and incrementing a counter isnt really robust enough because i need to match the files to a filemask. searching each filename for specific text is what im doing now but its a kludge and does not support wildcards.

all i need is a count for a specific filemask in a folder. any other ideas on how to do this? [i may post this as a new thread also in case you dont see it].

thanks...

 Category Survey
 06/14/2012 03:59 PM
User is offline View Users Profile Print this message

Author Icon
JivaJentile
Journeyman (50-99)

Posts: 94
Joined: 03/07/2006

i will look at %FileCount(bstrPath)% but im not sure it supposts a filemask...

 Category Survey
 06/14/2012 04:14 PM
User is offline View Users Profile Print this message

Author Icon
JivaJentile
Journeyman (50-99)

Posts: 94
Joined: 03/07/2006

ok answered my own question. this seems to work...

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 06/14/2012 10:12 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Hi Jiva !
Happy to see you in the forum after a long time. Happy also you could resolve the problem !

 Category Survey


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
Statistics
18257 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 6686 on 11/01/2020 at 01:24 AM.
There are currently 1135 guests browsing this forum, which makes a total of 1135 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2021 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog