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: Loop folder and read part of filename
Topic Summary:
Created On: 08/13/2013 06:57 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.
 08/13/2013 06:57 AM
User is offline View Users Profile Print this message

Author Icon
BasKwantes
Student (5-19 posts)

Posts: 11
Joined: 02/24/2011

Greetings All!

I need to create a task which loops trough a folder and compresses the files found to a ZIP file.
The files in the folder all start with a specific code like

AA_filename_97736.pdf
AA_filename_977356.pdf
AA_filename_977354656.pdf
B_filename_43279.pdf
B_filename_432rte79.pdf
B_filename_43re279.pdf
C_filename_3534.pdf
DD_filename_43789.pdf

I want to group all files based on the first code before the first '_' (AA or B or C of DD, etc....)
Then these files need to be zipped to a single file with the name: AAdate.zip / Bdate.zip / etc...

Can anyone help me with this. I don't know how to read the code before the first '_' then de-duplicate and place this in a dataset to loop.

The automate version used is 8.

Kind regards,
Bas

 Category Survey
 08/13/2013 03:26 PM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Bas,

Have you started to build your task? If so can you please post what you have created so far.?

 Category Survey
AutoMate 8 version:
Windows version:


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

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 08/13/2013 11:46 PM
User is offline View Users Profile Print this message

Author Icon
BasKwantes
Student (5-19 posts)

Posts: 11
Joined: 02/24/2011

Hello Ricardo,

below the task I have created:



A short explanation:
I create a variable 'currentdate' which gets todays date.
Then I create a variable 'Landcode' which gets filled/looped by a text file with the codes I want to use (the AA, B, C, DD etc.....)
The files then will be zipped.

The problem is that I now use a text file to fill the variable, but I want automate to read them from the filenames.



 Category Survey



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

Author Icon
SarathiKamaraj
Artisan (200-499)

Posts: 244
Joined: 07/30/2012

Hi Bas,

 

This is some steps i created now to group the files..

 

Take a look at this and apply zipping to the files accordingly.



 Category Survey



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


-------------------------
Thanks,
Sara
 08/14/2013 12:35 AM
User is offline View Users Profile Print this message

Author Icon
SarathiKamaraj
Artisan (200-499)

Posts: 244
Joined: 07/30/2012

And i tried this in BPA Server 9, so i am not sure of the difference its gonna make in Automate 8

 

Anyhow give it a try and let us know the outcome.....



 Category Survey


-------------------------
Thanks,
Sara
 08/14/2013 11:30 PM
User is offline View Users Profile Print this message

Author Icon
BasKwantes
Student (5-19 posts)

Posts: 11
Joined: 02/24/2011

Hi Sara,

The piece of code you provided was exactly what i needed.

Thank you very much for your help!

Kind regards,
Bas


 Category Survey
 08/20/2013 12:04 AM
User is offline View Users Profile Print this message

Author Icon
SarathiKamaraj
Artisan (200-499)

Posts: 244
Joined: 07/30/2012

Good to know it helped...



 Category Survey


-------------------------
Thanks,
Sara
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 2121 guests browsing this forum, which makes a total of 2121 users using this forum.

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

Sitemap Network Automation Software Blog