How i can get the most recent file inside "List files in folder" one drive

Iron Contributor

I have this flow, where i am getting all the root folders inside a user onedrive:-

 

 

 
 

image.png

 

 

then i am using "List files in folder" >> to get all the files inside each root folder. but i do not need all files i only need the latest file inside each of the root folders? any advice?

Thanks

1 Reply

 1.Add a compose to sorting the Folder files and get the recent one.

first(reverse(sort(outputs('List_files_in_folder')?['body/value'], 'LastModified')))

 

2.Utilize the 'Filter array' action to narrow down the selection of recent files, specifically targeting those files added at the same timestamp.

{

    "inputs": {

        "from": "@outputs('List_files_in_folder')?['body/value']",

        "where": "@equals(item()?['LastModified'], outputs('Sorting_Files')?['LastModified'])"

    }

It will loop and process each folder wise. you can make a further action along with it.

 

 

Let me know if this helps for you.

SanthoshBalakrishnan_0-1706869536120.png

@johnjohn-Peter