cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sbrownsecuretra
Frequent Visitor

Move files in desktop flow based on top 100 files.

Spoiler
I would like direction on how to select the top 10 files bars on sorting last modify date and copy or move them to a different folder. Using the desk top flow
7 REPLIES 7
VJR
Super User
Super User

You can use the Get Files action and in the Advanced section it will have an option to Sort by the modified date and choose the Descending switch as per your requirement.

This will give a Datatable called Files. Loop through the Files datatable for 10 times as you copy/move the files.

 

VJR_0-1658285042824.png

 

sbrownsecuretra
Frequent Visitor

how do I apply the loop? 

 

sbrownsecuretra
Frequent Visitor

It continues to bring over all the files instead of one at a time. 

sbrownsecuretra_0-1658323058373.png

 

Follow the pseudo logic.

-Set variable counter =1

-Get files in folder

-for each loop on %files%

If counter<=10 then

Copy files (make sure here you use current item and not %Files% as you have used which is causing everything to get copied) 

 

End if

Increase variable counter by 1

-end of for each loop

 

ryule
Skilled Sharer
Skilled Sharer

Here's the PAD version of VJR's post. Be sure the "Get files in folder" is sorted how you want it

ryule_0-1658330749977.png

 

sbrownsecuretra
Frequent Visitor

That worked!!! Thank you very much for your help. 

sbrownsecuretra_0-1658331798594.png

 

Be noted in your code Counter starts from 1 and the "IF" condition is <=10 which means 0 to 10. It will process 11 documents.

 

Either have:

 

Counter = 1

If Counter <=10

 

OR

 

Counter = 0

If Counter <10

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (4,706)