We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to dynamically run and pick up the most recent file in multiple folders

Mahabirpanigrahi
8 - Asteroid

HI Data Folks,

 

Need your suggestion here on "How to dynamically run and pick up the most recent file in multiple folders".

 

I have data in different folders, each folder has multiple excel files, i want to pick up the latest file from each folder. How is it possible ?

 

I read on the community page, found option to use Directory + Sort + Sample + Dynamic Input  will help. 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Select-Input-txt-file-based-on-creatio... 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-to-dynamically-run-the-most-rec...

 

 

Yes, if it will if i will pull the data from a folder. While my requirement was to pull the latest created file from each folder.

 

Have attached my data & Alteryx flow for you to review and suggest how to make it right ? 

 

Please please help!

 

Mahabir

8 REPLIES 8
T_Willins
14 - Magnetar
14 - Magnetar

Hi @Mahabirpanigrahi,

 

It looks like your workflow was very close.

 

1.  Change the Sort tool to first sort by directory ascending, then by creation time descending.

2.  Bring Sample tool in line with rest of workflow and sample first record, then group by directory.  

 

The rest of the workflow looks good.

 

select latest file.JPG

 

 

 

Mahabirpanigrahi
8 - Asteroid

@T_Willins You are a savior. Thank you thank you. 

ganesamurthy
8 - Asteroid

Sorry just noticed already answered.

 

In your Sample tool use group by Directory as shown below, to fetch all the required rows.:

 

ganesamurthy_0-1572582765667.png

Mahabirpanigrahi
8 - Asteroid

@ganesamurthy  Sure, will try that. Thanks. Appreciate your help!

T_Willins
14 - Magnetar
14 - Magnetar

Hi @Mahabirpanigrahi & @ganesamurthy,

 

You should only need a batch macro if the format of the files are different.  The Dynamic Input, like the regular Input tool, can import multiple files at once into a workflow as long as the files are in the same format.  A batch macro is needed if the files have different formats.

ganesamurthy
8 - Asteroid

I agree with @T_Willins 

 

I realized it soon after I wrote my message hence deleted that from my response.

Mahabirpanigrahi
8 - Asteroid

Thank you @T_Willins  & @ganesamurthy .

 

Another question to follow to this. If you can guide. [Already put it in Community page though].

 

Suppose Folder A "Latest .xlsx file", I have wrongly kept it open and run the work flow. So as per process the flow will throw me an error, and the data from that Folder A will not be picked thru Alteryx.

So, are there any way Alteryx will pick up the previous updated file ?

 

Is this something possible in Alteryx ?

 

Thank you in advance!

 

Mahabir.

T_Willins
14 - Magnetar
14 - Magnetar

Since that is already listed on this board as a separate post, I will put my answer there.

Labels