cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaybertx
Level: Powered On

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
Super User

Re: Folder Dates

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!

jaybertx
Level: Powered On

Re: Folder Dates

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!

v-lin-msft
Level 10

Re: Folder Dates

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,070)