Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

How to retreive newest file from a directory

TysonSri
6 - Meteoroid

I am looking for a newest file from the directory. 

 

Directory : C:\Documents\Files

 

In the above directory there are multiple files like below.

 

123_test_data20220830abc.csv

234_test_data20220829abd.csv

345_test_data20220828bcd.csv

 

From the above files I need to retrieve the latest (today's file).

 

Can you please let me know how do we do that..?

3 REPLIES 3
Luke_C
17 - Castor

Hi @TysonSri 

 

Are you able to rely on any of the date time fields the directory tool outputs? If so, just sort the files based on the relevant field and use a sample tool to take the first record. 

Luke_C_0-1661875595179.png

 

TysonSri
6 - Meteoroid

Thank you solution.

I want to populate data from latest file 

 

Using sorting option i managed to get latest file  now how to populate/import  data from the  latest file as output 

 

TysonSri_0-1661880952765.png

 

Thank you 

Luke_C
17 - Castor

You could use a dynamic input tool or batch macro to do that. There's lots of documentation on that in the community, but if you provide a sample file I could mock it up.

Labels