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: Find files in a range of subfolders
Topic Summary:
Created On: 10/10/2016 06:52 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.
 10/10/2016 06:52 PM
User is offline View Users Profile Print this message

Author Icon
SamuelHolder
Apprentice (20-49)

Posts: 44
Joined: 06/13/2006

On Monday of each week, I need to search all subfolders of a folder
C:\Timesheets\ for the end of the previous week.



If there exists a subfolder with the date matching the end of the previous week, then attach the contained spreadsheet

C:\Timesheets\Client 1\2016-10-08\Client1_2016-10-08_Timesheet.xls
C:\Timesheets\Client 2\2016-10-08\Client2_2016-10-08_Timesheet.xls
C:\Timesheets\Client 3\2016-10-01\Client3_2016-10-01_Timesheet.xls

From this example, I would only need spreadsheets from Client 1 and Client 2.



 Category Survey
AutoMate 9 version:
Windows version:
 10/11/2016 03:05 AM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

Not sure what you want to achieve, but from your example I would suggest that you look for files that start with the clientname and have the date you look for. So file names that include the string 'clientname_date'. This can be a relatively simple task.

 Category Survey


-------------------------
I am an A-Team Member
 10/11/2016 05:42 AM
User is offline View Users Profile Print this message

Author Icon
SamuelHolder
Apprentice (20-49)

Posts: 44
Joined: 06/13/2006

There are multiple client subfolders.

There may or may not be a date subfolder within each client.

I want to be able to search through all the client subfolders and see if there a matching date subfolder.

If a matching date subfolder is found, I want to pick up the xls file within that date subfolder.

From my example above, searching through the timesheets folder, the script would find a datesubfolder for client 1 and client 2.

 Category Survey
AutoMate 9 version:
Windows version:
 10/11/2016 07:22 AM
User is offline View Users Profile Print this message

Author Icon
Justin Aucoin
HelpSystems

Posts: 360
Joined: 02/15/2016

Hi Samuel,

You can use the Loop Files action, with the include subfolders option selected under advanced. You can then use an If Text contains statement on the filename or folder name to set your action. Attached is a sample of this.

 Category Survey
AutoMate 9 version:
Windows version:



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


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

Justin Aucoin | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 10/11/2016 07:22 AM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

If you use the loop files action, you can also include the subfolders and you can select the correct files by using a filename mask. You can then either treat a file when found, or store the filenames in a data set and treat these later.

 Category Survey


-------------------------
I am an A-Team Member
 10/11/2016 08:15 AM
User is offline View Users Profile Print this message

Author Icon
SamuelHolder
Apprentice (20-49)

Posts: 44
Joined: 06/13/2006

I was able to find the necessary files using the loop files in directory command.

I need to be able to attach the multiple files in an email.

 Category Survey
AutoMate 9 version:
Windows version:
 10/11/2016 09:16 AM
User is offline View Users Profile Print this message

Author Icon
SamuelHolder
Apprentice (20-49)

Posts: 44
Joined: 06/13/2006

I decided to copy each found file to a temp directory. I was then able to include the folder as an attachment.

Thanks all for you help. If there's another recommendation, I'm open to suggestions.

 Category Survey
AutoMate 9 version:
Windows version:
 10/11/2016 11:17 PM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

To attach the files to an email, you probably best use the dataset option (incl path name) to store the names of the files found in teh loop files action. The dataset is automatically created. fter you have finished the loop file action, you can use the loop dataset action to attach all files to your email.

 Category Survey


-------------------------
I am an A-Team Member
 10/12/2016 04:51 AM
User is offline View Users Profile Print this message

Author Icon
SamuelHolder
Apprentice (20-49)

Posts: 44
Joined: 06/13/2006

I'm using the send email command. There are multiple rows that allow for multiple attachments, but i don't understand how i would use a dataset to attach multiple files.

Are you saying to interact with a new mail GUI?

 Category Survey
AutoMate 9 version:
Windows version:
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 1719 guests browsing this forum, which makes a total of 1719 users using this forum.

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

Sitemap Network Automation Software Blog