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: Exclude files from Filecount in Database query (SQL)
Topic Summary: File count statement includes hidden file, need help on how to exclude
Created On: 01/12/2016 01:29 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.
 01/12/2016 01:29 AM
User is offline View Users Profile Print this message

Author Icon
StephanVon Meuleman
n00b (>6 posts)

Posts: 2
Joined: 01/29/2015

Hi

Wrote a small script to log the number of files found in a directory. Problem is that it also counts hidden file thumbs.db .

How do I exclude file from my filecount statement?



 Category Survey
AutoMate 10 version: 10.2.0
Windows version: Windows Server 2008 R2



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 01/13/2016 01:47 PM
User is offline View Users Profile Print this message

Author Icon
Alex Escalante
HelpSystems

Posts: 871
Joined: 02/26/2014

Hello Stephan,

We would recommend using Get Information Activity from the File System action. You can populate a dataset that will contain all of the filenames within the folder. You can also get the total number of files in the folder by referencing dataset.totalrows. See the attached code as an example.

Unfortunately we cannot troubleshoot your query as it falls outside of AutoMate. We apologize for the inconvenience.

 Category Survey


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

Alex Escalante | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 12/14/2017 08:32 AM
User is offline View Users Profile Print this message

Author Icon
ConTrelos
Apprentice (20-49)

Posts: 44
Joined: 09/01/2013

I am also interested in returning a numeric value to the number of files in a folder.

Only issue I have, is that the folder to be queried chances all the time.

 

I currently have the following code.

So, what happens is that I would already have Windows Explorer open on the folder already.

I then run the task which copies what is in the Address Bar and puts that text into a variable called "FolderNamePath"

This works by counting all the files in a folder (including the hidden thumbs.db file) and then using the Set Variable to subtract 1 from the FileCount.

Is there a more simpler or more elegant way of achieving the same result ? 
(to only count non-hidden files)



 Category Survey



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


Edited: 12/14/2017 at 08:51 AM by ConTrelos
 12/15/2017 07:22 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

It's exaclt how Alex described earlier. You can use the File System (Get Information) activity to populate a dataset with file information from the folder you specify. The is an exclude mask option in the File Options section that allows you to exclude thumbs.db. You can then reference dataset.TotalRows to get the file count.

 Category Survey


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

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
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 1225 guests browsing this forum, which makes a total of 1225 users using this forum.

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

Sitemap Network Automation Software Blog