Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
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: FileCount function changed in v11?
Topic Summary: Counts in subfolders instead of just the parent
Created On: 11/09/2017 03:19 PM
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.
 11/09/2017 03:19 PM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

In v10, the FileCount function only counts files in the parent folder, but in v11, it is counting all files in the parent and all subfolders. This is a going to affect many of our tasks/workflows. Was this change intentional? If so, any suggestions how to limit the count to just the parent folder?



-------------------------
<html />
 11/13/2017 03:58 PM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

I am implementing a workaround to use a PowerShell command to get a non-recursive file count.



-------------------------
<html />
 11/17/2017 09:28 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hello James,

If you still have your task (before the power shell) would it be possible to provide it?

-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 11/17/2017 09:37 AM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

Ricardo, I probably could, but it's a rather large task.

However, during testing I created a basic task to verify this and was able to recreate the issue.

All you have to do is create a folder structure similiar to something like:

D:\MyTestFldr\MyTestSubFldr

Put some files in MyTestFldr and MyTestSubFldr.

Execute a task action to do a FileCount("D:\MyTestFldr") and it will return a value reflecting the count of MyTestFldr + MyTestSubFldr.

In version 10 and prior, that function would only return the count from MyTestFldr.



-------------------------
<html />
 11/17/2017 01:46 PM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi James,

This has been reproduced and documented for correction:

23506 - FILECOUNT(): v11 returns file count of specified directory and its subdirectories, v10 returns file count of specified directory only

-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 11/20/2017 07:35 AM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

Thanks Leonard. For future reference, it would be nice if an extended version of this function could be developed to provide the ability to pass a parameter for a recursive folder count. Also, there have been numerous times where I only want to know a file count of a certain file type.

It would possibly look something like this:

FileCountv2("D:\MyTestFldr", 1, +"*.txt")

or

FileCountv2("D:\MyTestFld", 0, -"*.tmp")

 

In those examples, the 1 and 0 would indicate a True/False value to count recursively. The +"*.txt" would be a parameter to only count files with a file mask of *.txt, and the 2nd example with the minus sign would count all files except files of type "*.tmp".

 

Food for thought - thanks!



-------------------------
<html />
 11/21/2017 11:33 AM
User is offline View Users Profile Print this message

Author Icon
Devin Cannon
HelpSystems

Posts: 398
Joined: 03/17/2016

Hi James,

In case you're not aware, there is an action for this in AutoMate (File System: Get Information).  Please see the steps below.




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


-------------------------

Devin Cannon | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 11/27/2017 02:14 PM
User is offline View Users Profile Print this message

Author Icon
JamesLankford
Artisan (200-499)

Posts: 369
Joined: 11/26/2012

Hi Devon,

I have seen that before but had forgotten about it - thanks for the reminder.

I like to use simple functions like FileCount() and assign the return value to a variable when I can, instead of having to create an action for it and then assign it to a variable. In this case however, the Get Information action would probably be sufficient enough to meet the needs of my suggestion, but it was just a thought



-------------------------
<html />
 12/27/2017 01:55 PM
User is offline View Users Profile Print this message

Author Icon
Devin Cannon
HelpSystems

Posts: 398
Joined: 03/17/2016

Hi James

We would like to inform you that AutoMate version 11.0.2.22 has been released which addresses bug 23506.

Please review the patch notes for 11.0.2.22 here:
http://www.networkautomation.c...Automate-11/11.0.2/14/

-------------------------

Devin Cannon | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1564 guests browsing this forum, which makes a total of 1564 users using this forum.

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

Sitemap Network Automation Software Blog