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

Folder Dates

I have a document library in which the contents were recently migrated from a file server. 

 

This library has a list of folders, within those folders live several files. If none of the files within the folder have been modified in the prior month, the folder should be moved to archive. When these files lived on the file server, modifying any file also modified the folder date. So moving these folders manually once per month was easy. Now that it's in SharePoint, modifying the files does nothing to the folders. So it's become a problem. 

 

I can either build a flow that looks inside the individual folders and moves the folder if the files contained withing weren't modified in the prior month. 

 

OR

 

I can build a flow that compares a list of entries in an excel spreadsheet column to the list of folders and move any folders that do not exist in the Excel spreadsheet. 

 

I'm not sure if this is entirely clear but please let me know if you have any suggestions on how to achieve either of these objectives. I can't seem to figure out how to attack this. 

 

Thanks for any suggestions!!!

3 REPLIES 3
Super User II
Super User II

Avoid using Excel in your Flows if at all possible, due ot their very heavy limitations. You could use a SharePoint List for this task, but I think your first idea is likely the best way to attack it. All you have to do is use the Get files action for the document Library and use the ODATA Filter to filter out recently updated files, and utilize an Add a condition to a flow. FilterQuery.png

 

Here's a look at the Supported OData query options, which includes date/time:ODATAfiltering.png

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks for the direction. The Excel idea only came up because they regularly export a CSV list of active employees that they work off of. I'll scrap that and work from your suggestions. I'll report back with results/challenges. Appreciate it!

Hello @jaybertx ,

 

You can configure your flow as shown in the screenshots below,Annotation 2019-05-13 163831.png

 

 

Step1: Add List folder action to get the file of folder.

 

Step2: Add Apply to each action, and put in actions Filter array, to filter each file within folder whether have been modified in the prior month.

The first blank:

formatDateTime(item()?['LastModified'], 'yyyy-MM-dd')

The second blank:

addDays(utcNow(), -30, 'yyyy-MM-dd')

Annotation 2019-05-13 163931.png

Step3: set condition, and judge the length of "Filter array" output whether is 0.

-If yes, Move folder.

-If no, do nothing.

Function:

length(body('Filter_array'))

Annotation 2019-05-13 164702.png

If you have any questions, please contact us again.

 

Best Regards,

Community Support Team _ Lin Tu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (8,939)